policycoreutils: run_init: If open_init_pty is not available then just use exec

Sometimes using open_init_pty isn't possible.  So just call exec() if
that is the case.  We no longer ship open_init_pty in Fedora or RHEL6
since it was causing more problems then it was worth.  This fix makes
it optional to use the open_init_pty.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Eric Paris 2011-07-20 12:19:48 -04:00
parent 4a33c78ca5
commit d46e88abb6

View File

@ -406,6 +406,13 @@ int main(int argc, char *argv[])
new_context);
exit(-1);
}
if (! access("/usr/sbin/open_init_pty", X_OK)) {
if (execvp(argv[1], argv + 1)) {
perror("execvp");
exit(-1);
}
return 0;
}
/*
* Do not execvp the command directly from run_init; since it would run
* under with a pty under sysadm_devpts_t. Instead, we call open_init_tty,