1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

execute: make setup_pam() return -errno when possible

The only caller currently checks if the result is non-zero,
so nothing changes there.
This commit is contained in:
Michal Schmidt 2011-11-17 00:16:22 +01:00
parent 4d8a7798e7
commit 9ba353983a

View File

@ -716,6 +716,7 @@ static int setup_pam(
pam_handle_t *handle = NULL; pam_handle_t *handle = NULL;
sigset_t ss, old_ss; sigset_t ss, old_ss;
int pam_code = PAM_SUCCESS; int pam_code = PAM_SUCCESS;
int err;
char **e = NULL; char **e = NULL;
bool close_session = false; bool close_session = false;
pid_t pam_pid = 0, parent_pid; pid_t pam_pid = 0, parent_pid;
@ -835,6 +836,11 @@ static int setup_pam(
return 0; return 0;
fail: fail:
if (pam_code != PAM_SUCCESS)
err = -EPERM; /* PAM errors do not map to errno */
else
err = -errno;
if (handle) { if (handle) {
if (close_session) if (close_session)
pam_code = pam_close_session(handle, PAM_DATA_SILENT); pam_code = pam_close_session(handle, PAM_DATA_SILENT);
@ -851,7 +857,7 @@ fail:
kill(pam_pid, SIGCONT); kill(pam_pid, SIGCONT);
} }
return EXIT_PAM; return err;
} }
#endif #endif