Skip to contentSkip to conversation

Patch for quota-tools to avoid project quota crash

PATCH In review Theodore Ts'o 2 participants 3 messages Jul 6, 2016 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Patch for quota-tools to avoid project quota crash

Hi Jan,

This patch is needed to avoid "quota -v -P 123" from crashing if /etc/projid does not exist.

Cheers,

- Ted

Quoted 1 line

From b5edd1734a69364d614140273b812dc50d61842c Mon Sep 17 00:00:00 2001

From: Theodore Ts'o <[email protected]>
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.

---
 quotasys.c | 2 ++
 1 file changed, 2 insertions(+)
quotasys.c +2 -0
index c78e02c..fb40230 100644
@@ -98,6 +98,8 @@ void setprent(void)
 /* Close /etc/projid file */
 void endprent(void)
 {
+	if (!project_file)
+		return;
 	fclose(project_file);
 	project_file = NULL;
 }
Signature · 1 line
2.5.0
#1 lore raw
Quoted 4 lines · Theodore Ts'o

Hi Jan,

This patch is needed to avoid "quota -v -P 123" from crashing if /etc/projid does not exist.

Oops, I didn't see that Wang shilong had submitted a similar patch.

- Ted

reviewer
#2 lore raw
Quoted 7 lines · Ted Tso
Quoted 4 lines · Theodore Ts'o

Hi Jan,

This patch is needed to avoid "quota -v -P 123" from crashing if /etc/projid does not exist.

Oops, I didn't see that Wang shilong had submitted a similar patch.

Yes. I've merged the patch from Wang Shilong. Thanks for the fix anyway.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR