diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-03-07 18:09:06 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-03-07 18:09:06 +0000 |
commit | 77831c11d15861039eb8a30706d9b460363c5cc8 (patch) | |
tree | a2bf6e559137827445a09e4eaf9daa4f1aa44ba3 /util-linux | |
parent | 3719e9e7908ae002ef579b2ce39273f9d7130d40 (diff) | |
download | busybox-w32-77831c11d15861039eb8a30706d9b460363c5cc8.tar.gz busybox-w32-77831c11d15861039eb8a30706d9b460363c5cc8.tar.bz2 busybox-w32-77831c11d15861039eb8a30706d9b460363c5cc8.zip |
be more careful about cleaning up
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fdflush.c | 11 | ||||
-rw-r--r-- | util-linux/freeramdisk.c | 11 |
2 files changed, 17 insertions, 5 deletions
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index a4245c7e3..0756ddfbf 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c | |||
@@ -32,16 +32,23 @@ | |||
32 | 32 | ||
33 | extern int fdflush_main(int argc, char **argv) | 33 | extern int fdflush_main(int argc, char **argv) |
34 | { | 34 | { |
35 | int fd; | 35 | int fd, result; |
36 | 36 | ||
37 | if (argc <= 1) | 37 | if (argc <= 1) |
38 | show_usage(); | 38 | show_usage(); |
39 | if ((fd = open(*(++argv), 0)) < 0) | 39 | if ((fd = open(*(++argv), 0)) < 0) |
40 | goto die_the_death; | 40 | goto die_the_death; |
41 | 41 | ||
42 | if (ioctl(fd, FDFLUSH, 0)) | 42 | result = ioctl(fd, FDFLUSH, 0); |
43 | #ifdef CONFIG_FEATURE_CLEAN_UP | ||
44 | close(fd); | ||
45 | #endif | ||
46 | if (result) { | ||
43 | goto die_the_death; | 47 | goto die_the_death; |
48 | } | ||
44 | 49 | ||
50 | /* Don't bother closing. Exit does | ||
51 | * that, so we can save a few bytes */ | ||
45 | return EXIT_SUCCESS; | 52 | return EXIT_SUCCESS; |
46 | 53 | ||
47 | die_the_death: | 54 | die_the_death: |
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index aabb5f988..dd7700c06 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
@@ -37,20 +37,25 @@ | |||
37 | extern int | 37 | extern int |
38 | freeramdisk_main(int argc, char **argv) | 38 | freeramdisk_main(int argc, char **argv) |
39 | { | 39 | { |
40 | int result; | ||
40 | FILE *f; | 41 | FILE *f; |
41 | 42 | ||
42 | if (argc != 2 || *argv[1] == '-') { | 43 | if (argc != 2) { |
43 | show_usage(); | 44 | show_usage(); |
44 | } | 45 | } |
45 | 46 | ||
46 | f = xfopen(argv[1], "r+"); | 47 | f = xfopen(argv[1], "r+"); |
47 | 48 | ||
48 | if (ioctl(fileno(f), BLKFLSBUF) < 0) { | 49 | result = ioctl(fileno(f), BLKFLSBUF); |
50 | #ifdef CONFIG_FEATURE_CLEAN_UP | ||
51 | fclose(f); | ||
52 | #endif | ||
53 | if (result < 0) { | ||
49 | perror_msg_and_die("failed ioctl on %s", argv[1]); | 54 | perror_msg_and_die("failed ioctl on %s", argv[1]); |
50 | } | 55 | } |
56 | |||
51 | /* Don't bother closing. Exit does | 57 | /* Don't bother closing. Exit does |
52 | * that, so we can save a few bytes */ | 58 | * that, so we can save a few bytes */ |
53 | /* close(f); */ | ||
54 | return EXIT_SUCCESS; | 59 | return EXIT_SUCCESS; |
55 | } | 60 | } |
56 | 61 | ||