Linux filesystem development
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] Patch for quota-tools to avoid project quota crash
Date: Tue, 5 Jul 2016 21:22:29 -0400	[thread overview]
Message-ID: <20160706012229.GA23308@thunk.org> (raw)

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 <tytso@mit.edu>
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 <tytso@mit.edu>
---
 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


             reply	other threads:[~2016-07-06  1:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  1:22 Theodore Ts'o [this message]
2016-07-06  1:35 ` [PATCH] Patch for quota-tools to avoid project quota crash Theodore Ts'o
2016-07-06  9:47   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160706012229.GA23308@thunk.org \
    --to=tytso@mit.edu \
    --cc=jack@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox