summaryrefslogtreecommitdiff
path: root/util-linux/fdflush.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /util-linux/fdflush.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'util-linux/fdflush.c')
-rw-r--r--util-linux/fdflush.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index 0756ddfbf..c3fcf3325 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -25,6 +25,7 @@
25#include <sys/ioctl.h> 25#include <sys/ioctl.h>
26#include <fcntl.h> 26#include <fcntl.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <unistd.h>
28#include "busybox.h" 29#include "busybox.h"
29 30
30/* From <linux/fd.h> */ 31/* From <linux/fd.h> */
@@ -35,22 +36,19 @@ extern int fdflush_main(int argc, char **argv)
35 int fd, result; 36 int fd, result;
36 37
37 if (argc <= 1) 38 if (argc <= 1)
38 show_usage(); 39 bb_show_usage();
39 if ((fd = open(*(++argv), 0)) < 0) 40
40 goto die_the_death; 41 fd = bb_xopen(argv[1], 0);
41 42
42 result = ioctl(fd, FDFLUSH, 0); 43 result = ioctl(fd, FDFLUSH, 0);
43#ifdef CONFIG_FEATURE_CLEAN_UP 44#ifdef CONFIG_FEATURE_CLEAN_UP
44 close(fd); 45 close(fd);
45#endif 46#endif
46 if (result) { 47 if (result) {
47 goto die_the_death; 48 bb_perror_nomsg_and_die();
48 } 49 }
49 50
50 /* Don't bother closing. Exit does 51 /* Don't bother closing. Exit does
51 * that, so we can save a few bytes */ 52 * that, so we can save a few bytes */
52 return EXIT_SUCCESS; 53 return EXIT_SUCCESS;
53
54die_the_death:
55 perror_msg_and_die(NULL);
56} 54}