From patchwork Tue Feb 19 00:31:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 2160721 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DDCC53FDF1 for ; Tue, 19 Feb 2013 00:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753499Ab3BSAbR (ORCPT ); Mon, 18 Feb 2013 19:31:17 -0500 Received: from cantor2.suse.de ([195.135.220.15]:56201 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753460Ab3BSAbR (ORCPT ); Mon, 18 Feb 2013 19:31:17 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AF6C1A4C0E; Tue, 19 Feb 2013 01:31:15 +0100 (CET) Date: Tue, 19 Feb 2013 11:31:02 +1100 From: NeilBrown To: Steve Dickson Cc: NFS , Leonardo Chiquitto Subject: [PATCH - nfs-utils] gssd: use correct test for success of getrlimit() Message-ID: <20130219113102.265d9d03@notabene.brown> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- hangs head in shame .... NeilBrown diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index c17ab3b..e10bda6 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -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));