In case of error, return errno, instead of 1.

Suggested by:	delphij
Reviewed by:	delphij
Approved by:	grehan (mentor)
This commit is contained in:
Suleiman Souhlal 2005-01-26 06:39:20 +00:00
parent 72217cb810
commit 379b60989a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140847

View File

@ -30,6 +30,7 @@
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
#include <err.h> #include <err.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -52,13 +53,13 @@ main(int argc, char *argv[])
for (i = 1; i < argc; ++i) { for (i = 1; i < argc; ++i) {
if ((fd = open(argv[i], O_RDONLY)) < 0) { if ((fd = open(argv[i], O_RDONLY)) < 0) {
warn("open %s", argv[i]); warn("open %s", argv[i]);
rval = 1; rval = errno;
continue; continue;
} }
if (fsync(fd) != 0) { if (fsync(fd) != 0) {
warn("fsync %s", argv[i]); warn("fsync %s", argv[i]);
rval = 1; rval = errno;
} }
close(fd); close(fd);
} }