diff options
author | Tomas Mraz <tm@t8m.info> | 2008-04-08 07:01:41 +0000 |
---|---|---|
committer | Tomas Mraz <tm@t8m.info> | 2008-04-08 07:01:41 +0000 |
commit | e359d4ad55858b6440f5077d632f14249137add4 (patch) | |
tree | 6423d37ccf8de4a4ce2c61aa1f26bccb2f1bbbea /modules/pam_xauth/pam_xauth.c | |
parent | 586330938950c4f7abe3feaf967e1dccc0b1baef (diff) | |
download | pam-e359d4ad55858b6440f5077d632f14249137add4.tar.gz pam-e359d4ad55858b6440f5077d632f14249137add4.tar.bz2 pam-e359d4ad55858b6440f5077d632f14249137add4.zip |
Relevant BUGIDs:
Purpose of commit: cleanup
Commit summary:
---------------
2008-04-08 Tomas Mraz <t8m@centrum.cz>
* modules/pam_xauth/pam_xauth.c(run_coprocess): Avoid multiple
calls to sysconf() (based on patch by Sami Farin).
Diffstat (limited to 'modules/pam_xauth/pam_xauth.c')
-rw-r--r-- | modules/pam_xauth/pam_xauth.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/pam_xauth/pam_xauth.c b/modules/pam_xauth/pam_xauth.c index 1135d4b7..36f30708 100644 --- a/modules/pam_xauth/pam_xauth.c +++ b/modules/pam_xauth/pam_xauth.c @@ -118,6 +118,7 @@ run_coprocess(const char *input, char **output, size_t j; char *args[10]; const char *tmp; + int maxopened; /* Drop privileges. */ setgid(gid); setgroups(0, NULL); @@ -129,7 +130,8 @@ run_coprocess(const char *input, char **output, * descriptors. */ dup2(ipipe[0], STDIN_FILENO); dup2(opipe[1], STDOUT_FILENO); - for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) { + maxopened = (int)sysconf(_SC_OPEN_MAX); + for (i = 0; i < maxopened; i++) { if ((i != STDIN_FILENO) && (i != STDOUT_FILENO)) { close(i); } |