chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fecffe5
)
execute.c: little modernization
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 28 Aug 2013 11:54:43 +0000
(07:54 -0400)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 26 Sep 2013 09:12:03 +0000
(11:12 +0200)
src/core/execute.c
patch
|
blob
|
history
diff --git
a/src/core/execute.c
b/src/core/execute.c
index 0bfa41836afda89ef013e0b06da6d291e935ff3d..a53ef48ef83305ce231e4112574ea4c5922a63e0 100644
(file)
--- a/
src/core/execute.c
+++ b/
src/core/execute.c
@@
-760,24
+760,30
@@
static int setup_pam(
* daemon. We do things this way to ensure that the main PID
* of the daemon is the one we initially fork()ed. */
* daemon. We do things this way to ensure that the main PID
* of the daemon is the one we initially fork()ed. */
- if ((pam_code = pam_start(name, user, &conv, &handle)) != PAM_SUCCESS) {
+ pam_code = pam_start(name, user, &conv, &handle);
+ if (pam_code != PAM_SUCCESS) {
handle = NULL;
goto fail;
}
handle = NULL;
goto fail;
}
- if (tty)
- if ((pam_code = pam_set_item(handle, PAM_TTY, tty)) != PAM_SUCCESS)
+ if (tty) {
+ pam_code = pam_set_item(handle, PAM_TTY, tty);
+ if (pam_code != PAM_SUCCESS)
goto fail;
goto fail;
+ }
- if ((pam_code = pam_acct_mgmt(handle, PAM_SILENT)) != PAM_SUCCESS)
+ pam_code = pam_acct_mgmt(handle, PAM_SILENT);
+ if (pam_code != PAM_SUCCESS)
goto fail;
goto fail;
- if ((pam_code = pam_open_session(handle, PAM_SILENT)) != PAM_SUCCESS)
+ pam_code = pam_open_session(handle, PAM_SILENT);
+ if (pam_code != PAM_SUCCESS)
goto fail;
close_session = true;
goto fail;
close_session = true;
- if ((!(e = pam_getenvlist(handle)))) {
+ e = pam_getenvlist(handle);
+ if (!e) {
pam_code = PAM_BUF_ERR;
goto fail;
}
pam_code = PAM_BUF_ERR;
goto fail;
}
@@
-791,7
+797,8
@@
static int setup_pam(
parent_pid = getpid();
parent_pid = getpid();
- if ((pam_pid = fork()) < 0)
+ pam_pid = fork();
+ if (pam_pid < 0)
goto fail;
if (pam_pid == 0) {
goto fail;
if (pam_pid == 0) {
@@
-842,9
+849,11
@@
static int setup_pam(
}
/* If our parent died we'll end the session */
}
/* If our parent died we'll end the session */
- if (getppid() != parent_pid)
- if ((pam_code = pam_close_session(handle, PAM_DATA_SILENT)) != PAM_SUCCESS)
+ if (getppid() != parent_pid) {
+ pam_code = pam_close_session(handle, PAM_DATA_SILENT);
+ if (pam_code != PAM_SUCCESS)
goto child_finish;
goto child_finish;
+ }
r = 0;
r = 0;