summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Shilong <wshilong@ddn.com>2016-07-05 16:00:40 +0900
committerJan Kara <jack@suse.cz>2016-07-06 11:40:22 +0200
commit3715b0f5bd11116796f5f80144ceefe539b320aa (patch)
tree64080f5491673d44da16a6b4e4651a2fd0474b1f
parent2432de0526c282f05010cfa432059cbc9e794259 (diff)
downloadquota-tools-3715b0f5bd11116796f5f80144ceefe539b320aa.tar.gz
quota: fix coredump if projid file does not exist
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@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--quotasys.c6
1 files 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 */