summaryrefslogtreecommitdiff
path: root/util-linux/freeramdisk.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-05-08 13:09:28 +0000
committerGlenn L McGrath2003-05-08 13:09:28 +0000
commit8c6887c855460ee9e688e2a51e29f99faa2a2d8c (patch)
tree83af3734b04512a7ff5821530831b39210b73bea /util-linux/freeramdisk.c
parent7b3edeb14d46d25bc1bb8a732d951e6075e7e59c (diff)
downloadbusybox-8c6887c855460ee9e688e2a51e29f99faa2a2d8c.zip
busybox-8c6887c855460ee9e688e2a51e29f99faa2a2d8c.tar.gz
Use xopen instead of xfopen
Diffstat (limited to 'util-linux/freeramdisk.c')
-rw-r--r--util-linux/freeramdisk.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 9276a6c..00dc008 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
@@ -38,17 +37,17 @@ extern int
freeramdisk_main(int argc, char **argv)
{
int result;
- FILE *f;
+ int fd;
if (argc != 2) {
bb_show_usage();
}
- f = bb_xfopen(argv[1], "r+");
+ fd = bb_xopen(argv[1], O_RDWR);
- result = ioctl(fileno(f), BLKFLSBUF);
+ result = ioctl(fd, BLKFLSBUF);
#ifdef CONFIG_FEATURE_CLEAN_UP
- fclose(f);
+ close(fd);
#endif
if (result < 0) {
bb_perror_msg_and_die("failed ioctl on %s", argv[1]);