sys-utils: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
7bc5eeee44
commit
fd777151bf
9 changed files with 12 additions and 14 deletions
|
@ -667,7 +667,7 @@ static void umount_one(const struct eject_control *ctl, const char *name)
|
|||
else
|
||||
execl("/bin/umount", "/bin/umount", name, NULL);
|
||||
|
||||
errx(EXIT_FAILURE, _("unable to exec /bin/umount of `%s'"), name);
|
||||
errexec("/bin/umount");
|
||||
|
||||
case -1:
|
||||
warn( _("unable to fork"));
|
||||
|
|
|
@ -478,7 +478,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (optind < argc) {
|
||||
execvp(argv[optind], argv + optind);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
exec_shell();
|
||||
}
|
||||
|
|
|
@ -639,7 +639,7 @@ int main(int argc, char **argv)
|
|||
if (argc > optind) {
|
||||
/* prlimit [options] COMMAND */
|
||||
execvp(argv[optind], &argv[optind]);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -294,7 +294,7 @@ int main(int argc, char *argv[])
|
|||
if (set_arch(arch, 0L, 0))
|
||||
err(EXIT_FAILURE, _("Failed to set personality to %s"), arch);
|
||||
execl("/bin/bash", "", NULL);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), "/bin/bash");
|
||||
errexec("/bin/bash");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
@ -381,10 +381,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (!argc) {
|
||||
execl("/bin/sh", "-sh", NULL);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), "/bin/sh");
|
||||
errexec("/bin/sh");
|
||||
}
|
||||
|
||||
execvp(argv[0], argv);
|
||||
err(EXIT_FAILURE, "%s", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
errexec(argv[0]);
|
||||
}
|
||||
|
|
|
@ -990,6 +990,5 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
execvp(argv[optind], argv + optind);
|
||||
|
||||
err(EXIT_FAILURE, _("cannot execute: %s"), argv[optind]);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
|
|
|
@ -119,5 +119,5 @@ int main(int argc, char **argv)
|
|||
if (ctty && ioctl(STDIN_FILENO, TIOCSCTTY, 1))
|
||||
err(EXIT_FAILURE, _("failed to set the controlling terminal"));
|
||||
execvp(argv[optind], argv + optind);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ static int swap_reinitialize(struct swap_device *dev)
|
|||
cmd[idx++] = dev->path;
|
||||
cmd[idx++] = NULL;
|
||||
execvp(cmd[0], (char * const *) cmd);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), cmd[0]);
|
||||
errexec(cmd[0]);
|
||||
|
||||
default: /* parent */
|
||||
do {
|
||||
|
@ -353,7 +353,7 @@ static int swap_reinitialize(struct swap_device *dev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* mkswap returns: 0=suss, 1=error */
|
||||
/* mkswap returns: 0=suss, >0 error */
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status)==0)
|
||||
return 0; /* ok */
|
||||
break;
|
||||
|
|
|
@ -258,6 +258,6 @@ int main(int argc, char *argv[])
|
|||
warn(_("cannot access %s"), init);
|
||||
|
||||
execv(init, initargs);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), init);
|
||||
errexec(init);
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (optind < argc) {
|
||||
execvp(argv[optind], argv + optind);
|
||||
err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]);
|
||||
errexec(argv[optind]);
|
||||
}
|
||||
exec_shell();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue