- Fix usage of setmode. it can fail due to malloc, so we should print the correct error message.. - Continue, in case of error. - Add WARNS?= 6 Submitted by: Liam J. Foy Index: src/usr.bin/fsync/fsync.c =================================================================== --- src/usr.bin/fsync/fsync.c (revision 90) +++ src/usr.bin/fsync/fsync.c (revision 91) @@ -36,29 +36,36 @@ #include #include -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"); Index: src/usr.bin/fsync/Makefile =================================================================== --- src/usr.bin/fsync/Makefile (revision 90) +++ src/usr.bin/fsync/Makefile (revision 91) @@ -2,4 +2,5 @@ PROG= fsync +WARNS?= 6 .include