summaryrefslogtreecommitdiff
path: root/util-linux/fdflush.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
committerMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
commita9819b290848e0a760f3805d5937fa050235d707 (patch)
treeb8cb8d939032c0806d62161b01e5836cb808dc3f /util-linux/fdflush.c
parente9f07fb6e83b75a50760599a5d31f494841eddf7 (diff)
downloadbusybox-w32-a9819b290848e0a760f3805d5937fa050235d707.tar.gz
busybox-w32-a9819b290848e0a760f3805d5937fa050235d707.tar.bz2
busybox-w32-a9819b290848e0a760f3805d5937fa050235d707.zip
Use busybox error handling functions wherever possible.
Diffstat (limited to 'util-linux/fdflush.c')
-rw-r--r--util-linux/fdflush.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index 380015dde..5eb93ddd7 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -31,26 +31,16 @@
31 31
32extern int fdflush_main(int argc, char **argv) 32extern int fdflush_main(int argc, char **argv)
33{ 33{
34 int value;
35 int fd; 34 int fd;
36 35
37 if (argc <= 1 || **(++argv) == '-') 36 if (argc <= 1 || **(++argv) == '-')
38 usage(fdflush_usage); 37 usage(fdflush_usage);
39 38
40 fd = open(*argv, 0); 39 if ((fd = open(*argv, 0)) < 0)
41 if (fd < 0) { 40 perror_msg_and_die("%s", *argv);
42 perror(*argv);
43 return EXIT_FAILURE;
44 }
45 41
46 value = ioctl(fd, FDFLUSH, 0); 42 if (ioctl(fd, FDFLUSH, 0))
47 /* Don't bother closing. Exit does 43 perror_msg_and_die("%s", *argv);
48 * that, so we can save a few bytes */
49 /* close(fd); */
50 44
51 if (value) {
52 perror(*argv);
53 return EXIT_FAILURE;
54 }
55 return EXIT_SUCCESS; 45 return EXIT_SUCCESS;
56} 46}