diff options
author | Lauri Kasanen <curaga@operamail.com> | 2010-04-29 22:20:57 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-29 22:20:57 +0200 |
commit | d2844fcb6862c080177aaf314cc98d03e65b05ac (patch) | |
tree | a711e01d23ff8449ec055d07dcff4e54db5f4aaa /util-linux/swaponoff.c | |
parent | a659b81dfa435aa19130a8c7dd1bfe8fa9a22131 (diff) | |
download | busybox-w32-d2844fcb6862c080177aaf314cc98d03e65b05ac.tar.gz busybox-w32-d2844fcb6862c080177aaf314cc98d03e65b05ac.tar.bz2 busybox-w32-d2844fcb6862c080177aaf314cc98d03e65b05ac.zip |
swapon: skip noauto entries
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/swaponoff.c')
-rw-r--r-- | util-linux/swaponoff.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index f647a32bc..f2f52fb88 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -66,11 +66,20 @@ static int do_em_all(void) | |||
66 | bb_perror_msg_and_die("/etc/fstab"); | 66 | bb_perror_msg_and_die("/etc/fstab"); |
67 | 67 | ||
68 | err = 0; | 68 | err = 0; |
69 | while ((m = getmntent(f)) != NULL) | 69 | while ((m = getmntent(f)) != NULL) { |
70 | if (strcmp(m->mnt_type, MNTTYPE_SWAP) == 0) | 70 | if (strcmp(m->mnt_type, MNTTYPE_SWAP) == 0) { |
71 | err += swap_enable_disable(m->mnt_fsname); | 71 | /* swapon -a should ignore entries with noauto, |
72 | * but swapoff -a should process them */ | ||
73 | if (applet_name[5] != 'n' | ||
74 | || hasmntopt(m, MNTOPT_NOAUTO) == NULL | ||
75 | ) { | ||
76 | err += swap_enable_disable(m->mnt_fsname); | ||
77 | } | ||
78 | } | ||
79 | } | ||
72 | 80 | ||
73 | endmntent(f); | 81 | if (ENABLE_FEATURE_CLEAN_UP) |
82 | endmntent(f); | ||
74 | 83 | ||
75 | return err; | 84 | return err; |
76 | } | 85 | } |