diff options
-rw-r--r-- | util-linux/freeramdisk.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 9276a6c40..00dc00841 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
28 | #include <sys/ioctl.h> | 28 | #include <sys/ioctl.h> |
29 | #include <errno.h> | ||
30 | #include <stdlib.h> | 29 | #include <stdlib.h> |
31 | #include "busybox.h" | 30 | #include "busybox.h" |
32 | 31 | ||
@@ -38,17 +37,17 @@ extern int | |||
38 | freeramdisk_main(int argc, char **argv) | 37 | freeramdisk_main(int argc, char **argv) |
39 | { | 38 | { |
40 | int result; | 39 | int result; |
41 | FILE *f; | 40 | int fd; |
42 | 41 | ||
43 | if (argc != 2) { | 42 | if (argc != 2) { |
44 | bb_show_usage(); | 43 | bb_show_usage(); |
45 | } | 44 | } |
46 | 45 | ||
47 | f = bb_xfopen(argv[1], "r+"); | 46 | fd = bb_xopen(argv[1], O_RDWR); |
48 | 47 | ||
49 | result = ioctl(fileno(f), BLKFLSBUF); | 48 | result = ioctl(fd, BLKFLSBUF); |
50 | #ifdef CONFIG_FEATURE_CLEAN_UP | 49 | #ifdef CONFIG_FEATURE_CLEAN_UP |
51 | fclose(f); | 50 | close(fd); |
52 | #endif | 51 | #endif |
53 | if (result < 0) { | 52 | if (result < 0) { |
54 | bb_perror_msg_and_die("failed ioctl on %s", argv[1]); | 53 | bb_perror_msg_and_die("failed ioctl on %s", argv[1]); |