pdeath_execute.c: remove X_OK check, use execvp(3)

Both (F_OK|X_OK) cannot be tested at the same time, which means that
X_OK is X_OK for directories, too.  And anyway there's a huge period
of time between X_OK test and exec.  So I remove the test which cannot
be performed reliably.  As a bonus, I also replace execv() with execvp().
This commit is contained in:
Alexey Tourbin 2008-07-07 05:33:00 +04:00
parent 362a93334a
commit 312c51d845

View File

@ -78,9 +78,6 @@ main (int ac, char *const *av)
if (kill (pid, 0) < 0)
error (EXIT_FAILURE, errno, "kill: %u", pid);
if (access (av[2], X_OK))
error (EXIT_FAILURE, errno, "access: %s", av[2]);
/* Lets parent go on. */
if (daemon (1, 1) < 0)
error (EXIT_FAILURE, errno, "daemon");
@ -88,7 +85,7 @@ main (int ac, char *const *av)
/* Wait for parent completion. */
wait_for_pdeath (pid);
execv (av[2], av + 2);
execvp (av[2], av + 2);
error (EXIT_FAILURE, errno, "execv: %s", av[2]);
return EXIT_FAILURE;
}