]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
gssd: use correct test for success of getrlimit()
authorNeilBrown <neilb@suse.de>
Wed, 20 Mar 2013 17:03:17 +0000 (13:03 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 25 Mar 2013 14:09:09 +0000 (10:09 -0400)
commit 7c5cb5e732a4b8704f8c79ec819c5d271e040339
    gssd: base the size of the fd array on the RLIMIT_NOFILE limit.

didn't actually work as claimed.  It only uses the returned value
if getrlimit() returns -1  -- which of course it only does when
there was an error.

So change the test to "== 0".

Reported-by: Leonardo Chiquitto< lchiquitto@suse.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/gssd/gssd_proc.c

index c17ab3bf914526f433fb6c76ace1daa63c10d921..e10bda6f7de93bff46b0d4dd0c86200542c0d144 100644 (file)
@@ -477,7 +477,7 @@ init_client_list(void)
        TAILQ_INIT(&clnt_list);
        /* Eventually plan to grow/shrink poll array: */
        pollsize = FD_ALLOC_BLOCK;
-       if (getrlimit(RLIMIT_NOFILE, &rlim) < 0 &&
+       if (getrlimit(RLIMIT_NOFILE, &rlim) == 0 &&
            rlim.rlim_cur != RLIM_INFINITY)
                pollsize = rlim.rlim_cur;
        pollarray = calloc(pollsize, sizeof(struct pollfd));