swapon(8) is not expected to be setuid binary, but if it is try to avoid
obvious security vulnerability of executing user preferred mkswap file as
someone else, such as root.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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())) {