summaryrefslogtreecommitdiff
path: root/swaponoff.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-02-09 04:16:43 +0000
committerErik Andersen <andersen@codepoet.org>2000-02-09 04:16:43 +0000
commite132f4b09e5c9aedaef97f65279e8702633fd425 (patch)
tree50bfe1c027ff760e426ae31442da73e536dd4baa /swaponoff.c
parente49d5ecbbe51718fa925b6890a735e5937cc2aa2 (diff)
downloadbusybox-w32-e132f4b09e5c9aedaef97f65279e8702633fd425.tar.gz
busybox-w32-e132f4b09e5c9aedaef97f65279e8702633fd425.tar.bz2
busybox-w32-e132f4b09e5c9aedaef97f65279e8702633fd425.zip
Fixed the init problem where it wouldn't unmount filesystems
on reboot. Also fixed swapoff -a so it works. -Erik
Diffstat (limited to 'swaponoff.c')
-rw-r--r--swaponoff.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/swaponoff.c b/swaponoff.c
index 6bda22277..bc096ea95 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -36,13 +36,16 @@ static int whichApp;
36static const char *appName; 36static const char *appName;
37 37
38static const char swapoff_usage[] = 38static const char swapoff_usage[] =
39 "swapoff [OPTION] [device]\n\n"
40 "Stop swapping virtual memory pages on the given device.\n\n"
41 "Options:\n"
42 "\t-a\tStop swapping on all swap devices\n";
39 43
40 "swapoff device\n"
41 "\nStop swapping virtual memory pages on the given device.\n";
42static const char swapon_usage[] = 44static const char swapon_usage[] =
43 45 "swapon [OPTION] [device]\n\n"
44 "swapon device\n" 46 "Start swapping virtual memory pages on the given device.\n\n"
45 "\nStart swapping virtual memory pages on the given device.\n"; 47 "Options:\n"
48 "\t-a\tStart swapping on all swap devices\n";
46 49
47 50
48#define SWAPON_APP 1 51#define SWAPON_APP 1
@@ -85,12 +88,6 @@ static void do_em_all()
85 88
86extern int swap_on_off_main(int argc, char **argv) 89extern int swap_on_off_main(int argc, char **argv)
87{ 90{
88 struct stat statBuf;
89
90 if (stat("/etc/fstab", &statBuf) < 0)
91 fprintf(stderr,
92 "/etc/fstab file missing -- Please install one.\n\n");
93
94 if (strcmp(*argv, "swapon") == 0) { 91 if (strcmp(*argv, "swapon") == 0) {
95 appName = *argv; 92 appName = *argv;
96 whichApp = SWAPON_APP; 93 whichApp = SWAPON_APP;
@@ -100,8 +97,9 @@ extern int swap_on_off_main(int argc, char **argv)
100 whichApp = SWAPOFF_APP; 97 whichApp = SWAPOFF_APP;
101 } 98 }
102 99
103 if (argc < 2) 100 if (argc != 2) {
104 goto usage_and_exit; 101 goto usage_and_exit;
102 }
105 argc--; 103 argc--;
106 argv++; 104 argv++;
107 105
@@ -110,6 +108,7 @@ extern int swap_on_off_main(int argc, char **argv)
110 while (*++(*argv)) 108 while (*++(*argv))
111 switch (**argv) { 109 switch (**argv) {
112 case 'a': 110 case 'a':
111 whine_if_fstab_is_missing();
113 do_em_all(); 112 do_em_all();
114 break; 113 break;
115 default: 114 default: