summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2008-04-08 07:01:41 +0000
committerTomas Mraz <tm@t8m.info>2008-04-08 07:01:41 +0000
commite359d4ad55858b6440f5077d632f14249137add4 (patch)
tree6423d37ccf8de4a4ce2c61aa1f26bccb2f1bbbea
parent586330938950c4f7abe3feaf967e1dccc0b1baef (diff)
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).
-rw-r--r--ChangeLog5
-rw-r--r--modules/pam_xauth/pam_xauth.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 21485210..00c5a29b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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).
+
2008-04-07 Miloš Komarčević <kmilos@gmail.com>
* po/sr.po: New file with translation.
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);
}