summaryrefslogtreecommitdiff
path: root/src/execute.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2011-11-17 00:16:22 +0100
committerMichal Schmidt <mschmidt@redhat.com>2011-11-17 00:16:22 +0100
commit9ba353983adc026b75a503c1381f6e5c8062f3e0 (patch)
tree178b0bd21d0f12c14331d9e265a2880ee093b8ba /src/execute.c
parent4d8a7798e7f12c6400495cbc4d0ad57ed20ce90a (diff)
execute: make setup_pam() return -errno when possible
The only caller currently checks if the result is non-zero, so nothing changes there.
Diffstat (limited to 'src/execute.c')
-rw-r--r--src/execute.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/execute.c b/src/execute.c
index 065101431..203986178 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -716,6 +716,7 @@ static int setup_pam(
pam_handle_t *handle = NULL;
sigset_t ss, old_ss;
int pam_code = PAM_SUCCESS;
+ int err;
char **e = NULL;
bool close_session = false;
pid_t pam_pid = 0, parent_pid;
@@ -835,6 +836,11 @@ static int setup_pam(
return 0;
fail:
+ if (pam_code != PAM_SUCCESS)
+ err = -EPERM; /* PAM errors do not map to errno */
+ else
+ err = -errno;
+
if (handle) {
if (close_session)
pam_code = pam_close_session(handle, PAM_DATA_SILENT);
@@ -851,7 +857,7 @@ fail:
kill(pam_pid, SIGCONT);
}
- return EXIT_PAM;
+ return err;
}
#endif