]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorTomas Mraz <tm@t8m.info>
Tue, 8 Apr 2008 07:01:41 +0000 (07:01 +0000)
committerTomas Mraz <tm@t8m.info>
Tue, 8 Apr 2008 07:01:41 +0000 (07:01 +0000)
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).

ChangeLog
modules/pam_xauth/pam_xauth.c

index 214852106119aed6a98f4650088d404915170865..00c5a29b314b5946826201930fd46846af1f84a3 100644 (file)
--- 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.
index 1135d4b7244facc61c6e9e7da7094a14992addd8..36f30708c995b864c2a6db68a90565e7369bcdba 100644 (file)
@@ -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);
                        }