From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from imap.thunk.org ([74.207.234.97]:45528 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbcGFBWe (ORCPT ); Tue, 5 Jul 2016 21:22:34 -0400 Date: Tue, 5 Jul 2016 21:22:29 -0400 From: Theodore Ts'o To: Jan Kara Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] Patch for quota-tools to avoid project quota crash Message-ID: <20160706012229.GA23308@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Jan, This patch is needed to avoid "quota -v -P 123" from crashing if /etc/projid does not exist. Cheers, - Ted >>From b5edd1734a69364d614140273b812dc50d61842c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 5 Jul 2016 21:16:43 -0400 Subject: [PATCH] Don't crash if /etc/projid file does not exist In endprent(), if project_file is NULL, don't try to fclose it, or else glibc will not be amused. Signed-off-by: Theodore Ts'o --- quotasys.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quotasys.c b/quotasys.c index c78e02c..fb40230 100644 --- a/quotasys.c +++ b/quotasys.c @@ -98,6 +98,8 @@ void setprent(void) /* Close /etc/projid file */ void endprent(void) { + if (!project_file) + return; fclose(project_file); project_file = NULL; } -- 2.5.0