diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-12 18:16:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-12 18:16:24 +0000 |
commit | b3f09f4a5092aacbdc3da80d4fefeaf06445a4f8 (patch) | |
tree | 881fa2212e9166a4377eba16b1f8fc89704c3034 | |
parent | 214aec46bd7b96a1afeeb17f1129260db8c6157f (diff) | |
download | busybox-w32-b3f09f4a5092aacbdc3da80d4fefeaf06445a4f8.tar.gz busybox-w32-b3f09f4a5092aacbdc3da80d4fefeaf06445a4f8.tar.bz2 busybox-w32-b3f09f4a5092aacbdc3da80d4fefeaf06445a4f8.zip |
swapon: random shrinkage
-rw-r--r-- | util-linux/swaponoff.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index e1de4eb0c..3a6afe29e 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <mntent.h> | 11 | #include <mntent.h> |
12 | #include <sys/swap.h> | 12 | #include <sys/swap.h> |
13 | 13 | ||
14 | |||
15 | static int swap_enable_disable(char *device) | 14 | static int swap_enable_disable(char *device) |
16 | { | 15 | { |
17 | int status; | 16 | int status; |
@@ -19,10 +18,12 @@ static int swap_enable_disable(char *device) | |||
19 | 18 | ||
20 | xstat(device, &st); | 19 | xstat(device, &st); |
21 | 20 | ||
21 | #ifdef BLOAT | ||
22 | /* test for holes */ | 22 | /* test for holes */ |
23 | if (S_ISREG(st.st_mode)) | 23 | if (S_ISREG(st.st_mode)) |
24 | if (st.st_blocks * 512 < st.st_size) | 24 | if (st.st_blocks * 512 < st.st_size) |
25 | bb_error_msg_and_die("swap file has holes"); | 25 | bb_error_msg_and_die("swap file has holes"); |
26 | #endif | ||
26 | 27 | ||
27 | if (applet_name[5] == 'n') | 28 | if (applet_name[5] == 'n') |
28 | status = swapon(device, 0); | 29 | status = swapon(device, 0); |
@@ -57,8 +58,6 @@ static int do_em_all(void) | |||
57 | return err; | 58 | return err; |
58 | } | 59 | } |
59 | 60 | ||
60 | #define DO_ALL 0x01 | ||
61 | |||
62 | int swap_on_off_main(int argc, char **argv); | 61 | int swap_on_off_main(int argc, char **argv); |
63 | int swap_on_off_main(int argc, char **argv) | 62 | int swap_on_off_main(int argc, char **argv) |
64 | { | 63 | { |
@@ -68,10 +67,10 @@ int swap_on_off_main(int argc, char **argv) | |||
68 | bb_show_usage(); | 67 | bb_show_usage(); |
69 | 68 | ||
70 | ret = getopt32(argc, argv, "a"); | 69 | ret = getopt32(argc, argv, "a"); |
71 | if (ret & DO_ALL) | 70 | if (ret) |
72 | return do_em_all(); | 71 | return do_em_all(); |
73 | 72 | ||
74 | ret = 0; | 73 | /* ret = 0; redundant */ |
75 | while (*++argv) | 74 | while (*++argv) |
76 | ret += swap_enable_disable(*argv); | 75 | ret += swap_enable_disable(*argv); |
77 | return ret; | 76 | return ret; |