In case of error, return errno, instead of 1.
Suggested by: delphij Reviewed by: delphij Approved by: grehan (mentor)
This commit is contained in:
parent
570c925965
commit
df36be78f5
@ -30,6 +30,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,13 +53,13 @@ main(int argc, char *argv[])
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if ((fd = open(argv[i], O_RDONLY)) < 0) {
|
||||
warn("open %s", argv[i]);
|
||||
rval = 1;
|
||||
rval = errno;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fsync(fd) != 0) {
|
||||
warn("fsync %s", argv[i]);
|
||||
rval = 1;
|
||||
rval = errno;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user