summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorssouhlal <ssouhlal@FreeBSD.org>2005-01-25 14:12:01 +0000
committerssouhlal <ssouhlal@FreeBSD.org>2005-01-25 14:12:01 +0000
commitf078f804f9b05bc485949ffcabe112d062831b11 (patch)
treebc6dcb2e7644932df09c81ea29975bc55ad92748
parentb4d95a651fab2a00821e74092da4363884e92fff (diff)
downloadFreeBSD-src-f078f804f9b05bc485949ffcabe112d062831b11.zip
FreeBSD-src-f078f804f9b05bc485949ffcabe112d062831b11.tar.gz
- Continue, in case of error.
- Add WARNS?= 6 Submitted by: Liam J. Foy <liamfoy@gmail.com> Approved by: stefanf, grehan (mentor)
-rw-r--r--usr.bin/fsync/Makefile1
-rw-r--r--usr.bin/fsync/fsync.c21
2 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/fsync/Makefile b/usr.bin/fsync/Makefile
index c9bc524..42aa6dd 100644
--- a/usr.bin/fsync/Makefile
+++ b/usr.bin/fsync/Makefile
@@ -2,4 +2,5 @@
PROG= fsync
+WARNS?= 6
.include <bsd.prog.mk>
diff --git a/usr.bin/fsync/fsync.c b/usr.bin/fsync/fsync.c
index 95bacfb..764e79d 100644
--- a/usr.bin/fsync/fsync.c
+++ b/usr.bin/fsync/fsync.c
@@ -36,29 +36,36 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <unistd.h>
-void usage(void);
+static void usage(void);
int
main(int argc, char *argv[])
{
int fd;
int i;
+ int rval;
if (argc < 2)
usage();
+ rval = 0;
for (i = 1; i < argc; ++i) {
- if ((fd = open(argv[i], O_RDONLY)) < 0)
- err(1, "open %s", argv[i]);
+ if ((fd = open(argv[i], O_RDONLY)) < 0) {
+ warn("open %s", argv[i]);
+ rval = 1;
+ continue;
+ }
- if (fsync(fd) != 0)
- err(1, "fsync %s", argv[1]);
+ if (fsync(fd) != 0) {
+ warn("fsync %s", argv[i]);
+ rval = 1;
+ }
close(fd);
}
- return(0);
+ return (rval);
}
-void
+static void
usage()
{
fprintf(stderr, "usage: fsync file ...\n");
OpenPOWER on IntegriCloud