Rather than hardcode /sbin/mkswap all the time, use a normal PATH search.
This matches the normal behavior of other tools, and makes local testing
easier.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
.TP
.BR \-f , " \-\-fixpgsz"
-Reinitialize (exec /sbin/mkswap) the swap space if its page size does not
+Reinitialize (exec mkswap) the swap space if its page size does not
match that of the current running kernel.
.BR mkswap (2)
initializes the whole device and does not check for bad blocks.
#include "swapprober.h"
#include "swapon-common.h"
-#define PATH_MKSWAP "/sbin/mkswap"
-
#ifdef HAVE_SYS_SWAP_H
# include <sys/swap.h>
#endif
return -1;
case 0: /* child */
- cmd[idx++] = PATH_MKSWAP;
+ cmd[idx++] = "mkswap";
if (label && *label) {
cmd[idx++] = "-L";
cmd[idx++] = (char *) label;
}
cmd[idx++] = (char *) device;
cmd[idx++] = NULL;
- execv(cmd[0], cmd);
+ execvp(cmd[0], cmd);
err(EXIT_FAILURE, _("failed to execute %s"), cmd[0]);
default: /* parent */