2011-08-20 Jonathan Nieder <jrnieder@gmail.com>
* lib/Makefile.am: Added lib/spawn.c and lib/spawn.h. * lib/nscd.c, lib/spawn.c, lib/spawn.h: It is not possible to differentiate between an nscd failure, and a failure to execute due to no nscd with posix_spawn. Use our own run_command routine. * src/userdel.c: Use run_command()
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
#ifdef SHADOWGRP
|
||||
#include "sgroupio.h"
|
||||
#endif /* SHADOWGRP */
|
||||
#include "spawn.h"
|
||||
#ifdef WITH_TCB
|
||||
#include <tcb.h>
|
||||
#include "tcbfuncs.h"
|
||||
@@ -628,6 +629,7 @@ static void update_user (void)
|
||||
static void user_cancel (const char *user)
|
||||
{
|
||||
const char *cmd;
|
||||
const char *argv[3];
|
||||
pid_t pid, wpid;
|
||||
int status;
|
||||
|
||||
@@ -635,18 +637,10 @@ static void user_cancel (const char *user)
|
||||
if (NULL == cmd) {
|
||||
return;
|
||||
}
|
||||
pid = fork ();
|
||||
if (pid == 0) {
|
||||
execl (cmd, cmd, user, (char *) 0);
|
||||
perror (cmd);
|
||||
exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
|
||||
} else if ((pid_t)-1 == pid) {
|
||||
perror ("fork");
|
||||
return;
|
||||
}
|
||||
do {
|
||||
wpid = wait (&status);
|
||||
} while ((wpid != pid) && ((pid_t)-1 != wpid));
|
||||
argv[0] = cmd;
|
||||
argv[1] = user;
|
||||
argv[2] = (char *)0;
|
||||
(void) run_command (cmd, argv, NULL, &status);
|
||||
}
|
||||
|
||||
#ifdef EXTRA_CHECK_HOME_DIR
|
||||
|
Reference in New Issue
Block a user