diff options
author | Eric Andersen | 2003-03-07 18:09:06 +0000 |
---|---|---|
committer | Eric Andersen | 2003-03-07 18:09:06 +0000 |
commit | 77831c11d15861039eb8a30706d9b460363c5cc8 (patch) | |
tree | a2bf6e559137827445a09e4eaf9daa4f1aa44ba3 /util-linux/freeramdisk.c | |
parent | 3719e9e7908ae002ef579b2ce39273f9d7130d40 (diff) | |
download | busybox-77831c11d15861039eb8a30706d9b460363c5cc8.zip busybox-77831c11d15861039eb8a30706d9b460363c5cc8.tar.gz |
be more careful about cleaning up
Diffstat (limited to 'util-linux/freeramdisk.c')
-rw-r--r-- | util-linux/freeramdisk.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index aabb5f9..dd7700c 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -37,20 +37,25 @@ extern int freeramdisk_main(int argc, char **argv) { + int result; FILE *f; - if (argc != 2 || *argv[1] == '-') { + if (argc != 2) { show_usage(); } f = xfopen(argv[1], "r+"); - if (ioctl(fileno(f), BLKFLSBUF) < 0) { + result = ioctl(fileno(f), BLKFLSBUF); +#ifdef CONFIG_FEATURE_CLEAN_UP + fclose(f); +#endif + if (result < 0) { perror_msg_and_die("failed ioctl on %s", argv[1]); } + /* Don't bother closing. Exit does * that, so we can save a few bytes */ - /* close(f); */ return EXIT_SUCCESS; } |