X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=util-linux%2Ffdflush.c;h=c3fcf3325c3e1fc08293a2a71dd57d99f1e70b7e;hb=50547c07451d07178eeb64e7d8637952b427bd4c;hp=a4245c7e3e677690aac7065f201a2c8f7b681e62;hpb=3719e9e7908ae002ef579b2ce39273f9d7130d40;p=oweals%2Fbusybox.git diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index a4245c7e3..c3fcf3325 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "busybox.h" /* From */ @@ -32,18 +33,22 @@ extern int fdflush_main(int argc, char **argv) { - int fd; + int fd, result; if (argc <= 1) - show_usage(); - if ((fd = open(*(++argv), 0)) < 0) - goto die_the_death; + bb_show_usage(); - if (ioctl(fd, FDFLUSH, 0)) - goto die_the_death; + fd = bb_xopen(argv[1], 0); - return EXIT_SUCCESS; + result = ioctl(fd, FDFLUSH, 0); +#ifdef CONFIG_FEATURE_CLEAN_UP + close(fd); +#endif + if (result) { + bb_perror_nomsg_and_die(); + } -die_the_death: - perror_msg_and_die(NULL); + /* Don't bother closing. Exit does + * that, so we can save a few bytes */ + return EXIT_SUCCESS; }