mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-02 08:42:48 +00:00
- Continue, in case of error.
- Add WARNS?= 6 Submitted by: Liam J. Foy <liamfoy@gmail.com> Approved by: stefanf, grehan (mentor)
This commit is contained in:
parent
46c2bd6103
commit
e5faa1a423
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140811
@ -2,4 +2,5 @@
|
||||
|
||||
PROG= fsync
|
||||
|
||||
WARNS?= 6
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user