Skip to contentSkip to conversation

gssd: use correct test for success of getrlimit()

PATCH In review NeilBrown 2 participants 2 messages Feb 19, 2013 – Mar 25, 2013

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 gssd: use correct test for success of getrlimit()

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".

--
hangs head in shame .... NeilBrown

utils/gssd/gssd_proc.c +1 -1
index c17ab3b..e10bda6 100644
@@ -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));
#1 lore raw
Quoted 8 lines · NeilBrown

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.

Quoted 7 lines

So change the test to "== 0".

--
hangs head in shame .... NeilBrown

Committed...

steved.

Quoted 15 lines
utils/gssd/gssd_proc.c +1 -1
index c17ab3b..e10bda6 100644
@@ -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));