summaryrefslogtreecommitdiffstats
path: root/sys-utils/swapon.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/swapon.c')
-rw-r--r--sys-utils/swapon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 5ad5cd1f3..be8f7718b 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -297,6 +297,10 @@ static int swap_reinitialize(struct swapon_ctl *ctl)
char const *cmd[7];
int idx=0;
+ if (geteuid() != getuid()) {
+ warnx(_("will not execute mkswap when swapon is setuid binary"));
+ return -1;
+ }
warnx(_("%s: reinitializing the swap."), ctl->device);
switch((pid=fork())) {