[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1467702040-14764-1-git-send-email-wangshilong1991@gmail.com>
Date: Tue, 5 Jul 2016 16:00:40 +0900
From: Wang Shilong <wangshilong1991@...il.com>
To: jack@...e.cz
Cc: linux-ext4@...r.kernel.org, sihara@....com, lixi@....com,
Wang Shilong <wshilong@....com>
Subject: [PATCH] quota: fix coredump if projid file dose not exist
From: Wang Shilong <wshilong@....com>
if '/etc/projid' dose not exist,@project_file will
be NULL pointer, fclose will cause coredump, add
check in endprent().
Signed-off-by: Wang Shilong <wshilong@....com>
---
quotasys.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/quotasys.c b/quotasys.c
index c78e02c..d04f25a 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -98,8 +98,10 @@ void setprent(void)
/* Close /etc/projid file */
void endprent(void)
{
- fclose(project_file);
- project_file = NULL;
+ if (project_file) {
+ fclose(project_file);
+ project_file = NULL;
+ }
}
/* Get next entry in /etc/projid */
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists