summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-12-18 20:34:12 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2012-12-18 20:34:46 -0800
commit0b3d84a0ee95d07f819a39de596ecb6578fd8910 (patch)
tree37a12641fde9d576e8d3555eba12c6c995d73122 /tests
parent23965e151e3c86367fe23d93613f3686a6104763 (diff)
downloadpaxutils-0b3d84a0ee95d07f819a39de596ecb6578fd8910.tar.gz
maint: remove lint uncovered by tar's new use of manywarnings
* lib/rmt.h, lib/rtapelib.c (rmt_command, rmt_dev_name__): Now pointer to const. * lib/rtapelib.c (rmt_open__): Check return codes from dup2, close. Don't mishandle the case when 'pipe' allocates file descriptor 0. * lib/system.h (sys_reset_uid_gid): Check return codes from setuid, setgid. * tests/genfile.c (mkhole, exec_checkpoint): Check return code from ftruncate. (mkhole): Don't call fseek twice. (exec_checkpoint): Check return code from system. (exec_command): Check return code from pipe.
Diffstat (limited to 'tests')
-rw-r--r--tests/genfile.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/genfile.c b/tests/genfile.c
index 8541be6..fa480ef 100644
--- a/tests/genfile.c
+++ b/tests/genfile.c
@@ -485,9 +485,11 @@ generate_files_from_list ()
static void
mkhole (int fd, off_t displ)
{
- if (lseek (fd, displ, SEEK_CUR) == -1)
+ off_t offset = lseek (fd, displ, SEEK_CUR);
+ if (offset < 0)
error (EXIT_FAILURE, errno, "lseek");
- ftruncate (fd, lseek (fd, 0, SEEK_CUR));
+ if (ftruncate (fd, offset) != 0)
+ error (EXIT_FAILURE, errno, "ftruncate");
}
static void
@@ -685,13 +687,18 @@ exec_checkpoint (struct action *p)
error (0, errno, _("cannot open `%s'"), p->name);
break;
}
- ftruncate (fd, p->size);
+ if (ftruncate (fd, p->size) != 0)
+ {
+ error (0, errno, _("cannot truncate `%s'"), p->name);
+ break;
+ }
close (fd);
}
break;
case OPT_EXEC:
- system (p->name);
+ if (system (p->name) != 0)
+ error (0, 0, _("command failed: %s"), p->name);
break;
case OPT_UNLINK:
@@ -761,7 +768,8 @@ exec_command (void)
signal (SIGCHLD, SIG_DFL);
#endif
- pipe (fd);
+ if (pipe (fd) != 0)
+ error (EXIT_FAILURE, errno, "pipe");
pid = fork ();
if (pid == -1)