cast NULL to char * when using execl
When calling variadic functions, NULL must be explicitly cast to a desired type. This is noted in the exec(3) manpage. The call in newgrp.c was changed for consistency. Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
This commit is contained in:
parent
9210db64a6
commit
1b10fa0ef7
|
@ -46,6 +46,6 @@ void __attribute__((__noreturn__)) exec_shell(void)
|
|||
arg0[0] = '-';
|
||||
strcpy(arg0 + 1, shell_basename);
|
||||
|
||||
execl(shell, arg0, NULL);
|
||||
execl(shell, arg0, (char *)NULL);
|
||||
errexec(shell);
|
||||
}
|
||||
|
|
|
@ -699,9 +699,9 @@ int main(int argc, char *argv[])
|
|||
shname = shname ? shname + 1 : shell;
|
||||
|
||||
if (command)
|
||||
execl(shell, shname, "-c", command, NULL);
|
||||
execl(shell, shname, "-c", command, (char *)NULL);
|
||||
else
|
||||
execl(shell, shname, "-i", NULL);
|
||||
execl(shell, shname, "-i", (char *)NULL);
|
||||
err(EXIT_FAILURE, "failed to execute %s", shell);
|
||||
break;
|
||||
|
||||
|
|
|
@ -234,6 +234,6 @@ int main(int argc, char *argv[])
|
|||
fflush(NULL);
|
||||
shell = (pw_entry->pw_shell && *pw_entry->pw_shell ?
|
||||
pw_entry->pw_shell : _PATH_BSHELL);
|
||||
execl(shell, shell, (char *)0);
|
||||
execl(shell, shell, (char *)NULL);
|
||||
errexec(shell);
|
||||
}
|
||||
|
|
|
@ -789,11 +789,11 @@ static void sushell(struct passwd *pwd)
|
|||
free(level);
|
||||
}
|
||||
#endif
|
||||
execl(su_shell, shell, NULL);
|
||||
execl(su_shell, shell, (char *)NULL);
|
||||
warn(_("failed to execute %s"), su_shell);
|
||||
|
||||
xsetenv("SHELL", "/bin/sh", 1);
|
||||
execl("/bin/sh", profile ? "-sh" : "sh", NULL);
|
||||
execl("/bin/sh", profile ? "-sh" : "sh", (char *)NULL);
|
||||
warn(_("failed to execute %s"), "/bin/sh");
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ static void pw_edit(void)
|
|||
err(EXIT_FAILURE, _("fork failed"));
|
||||
|
||||
if (!pid) {
|
||||
execlp(editor, p, tmp_file, NULL);
|
||||
execlp(editor, p, tmp_file, (char *)NULL);
|
||||
errexec(editor);
|
||||
}
|
||||
for (;;) {
|
||||
|
|
|
@ -663,9 +663,9 @@ static void umount_one(const struct eject_control *ctl, const char *name)
|
|||
err(EXIT_FAILURE, _("cannot set user id"));
|
||||
|
||||
if (ctl->p_option)
|
||||
execl("/bin/umount", "/bin/umount", name, "-n", NULL);
|
||||
execl("/bin/umount", "/bin/umount", name, "-n", (char *)NULL);
|
||||
else
|
||||
execl("/bin/umount", "/bin/umount", name, NULL);
|
||||
execl("/bin/umount", "/bin/umount", name, (char *)NULL);
|
||||
|
||||
errexec("/bin/umount");
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ set_arch:
|
|||
|
||||
/* Execute shell */
|
||||
if (shell) {
|
||||
execl(shell, shell_arg, NULL);
|
||||
execl(shell, shell_arg, (char *)NULL);
|
||||
errexec(shell);
|
||||
}
|
||||
|
||||
|
|
|
@ -967,14 +967,14 @@ int main(int argc, char **argv)
|
|||
|
||||
if (access(shell, X_OK) == 0) {
|
||||
if (command)
|
||||
execl(shell, shname, "-c", command, NULL);
|
||||
execl(shell, shname, "-c", command, (char *)NULL);
|
||||
else
|
||||
execl(shell, shname, "-i", NULL);
|
||||
execl(shell, shname, "-i", (char *)NULL);
|
||||
} else {
|
||||
if (command)
|
||||
execlp(shname, "-c", command, NULL);
|
||||
execlp(shname, "-c", command, (char *)NULL);
|
||||
else
|
||||
execlp(shname, "-i", NULL);
|
||||
execlp(shname, "-i", (char *)NULL);
|
||||
}
|
||||
|
||||
err(EXIT_FAILURE, "failed to execute %s", shell);
|
||||
|
|
|
@ -316,14 +316,14 @@ main(int argc, char *argv[])
|
|||
|
||||
if (access(shell, X_OK) == 0) {
|
||||
if (command)
|
||||
execl(shell, shname, "-c", command, NULL);
|
||||
execl(shell, shname, "-c", command, (char *)NULL);
|
||||
else
|
||||
execl(shell, shname, "-i", NULL);
|
||||
execl(shell, shname, "-i", (char *)NULL);
|
||||
} else {
|
||||
if (command)
|
||||
execlp(shname, "-c", command, NULL);
|
||||
execlp(shname, "-c", command, (char *)NULL);
|
||||
else
|
||||
execlp(shname, "-i", NULL);
|
||||
execlp(shname, "-i", (char *)NULL);
|
||||
}
|
||||
err(EXIT_FAILURE, "failed to execute %s", shell);
|
||||
break;
|
||||
|
|
|
@ -1382,7 +1382,7 @@ static void pgfile(FILE *f, const char *name)
|
|||
my_sigset(SIGQUIT, oldquit);
|
||||
my_sigset(SIGTERM, oldterm);
|
||||
execl(sh, sh, "-c",
|
||||
cmd.cmdline + 1, NULL);
|
||||
cmd.cmdline + 1, (char *)NULL);
|
||||
errexec(sh);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue