diff options
-rw-r--r-- | util-linux/swaponoff.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index bcceff772..d5bfe1888 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -82,6 +82,9 @@ static int do_em_all(void) | |||
82 | struct mntent *m; | 82 | struct mntent *m; |
83 | FILE *f; | 83 | FILE *f; |
84 | int err; | 84 | int err; |
85 | #ifdef G | ||
86 | int cl_flags = g_flags; | ||
87 | #endif | ||
85 | 88 | ||
86 | f = setmntent("/etc/fstab", "r"); | 89 | f = setmntent("/etc/fstab", "r"); |
87 | if (f == NULL) | 90 | if (f == NULL) |
@@ -97,14 +100,14 @@ static int do_em_all(void) | |||
97 | ) { | 100 | ) { |
98 | #if ENABLE_FEATURE_SWAPON_PRI | 101 | #if ENABLE_FEATURE_SWAPON_PRI |
99 | char *p; | 102 | char *p; |
100 | g_flags = 0; /* each swap space might have different flags */ | 103 | g_flags = cl_flags; /* each swap space might have different flags */ |
101 | p = hasmntopt(m, "pri"); | 104 | p = hasmntopt(m, "pri"); |
102 | if (p) { | 105 | if (p) { |
103 | /* Max allowed 32767 (== SWAP_FLAG_PRIO_MASK) */ | 106 | /* Max allowed 32767 (== SWAP_FLAG_PRIO_MASK) */ |
104 | unsigned prio = bb_strtou(p + 4, NULL, 10); | 107 | unsigned prio = bb_strtou(p + 4, NULL, 10); |
105 | /* We want to allow "NNNN,foo", thus errno == EINVAL is allowed too */ | 108 | /* We want to allow "NNNN,foo", thus errno == EINVAL is allowed too */ |
106 | if (errno != ERANGE) { | 109 | if (errno != ERANGE) { |
107 | g_flags = SWAP_FLAG_PREFER | | 110 | g_flags = (g_flags & ~SWAP_FLAG_PRIO_MASK) | SWAP_FLAG_PREFER | |
108 | MIN(prio, SWAP_FLAG_PRIO_MASK); | 111 | MIN(prio, SWAP_FLAG_PRIO_MASK); |
109 | } | 112 | } |
110 | } | 113 | } |