Blob Blame History Raw
From 7d2ac8097d65c6698124abd2dda25bffd8590aa7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 17 Aug 2011 16:16:12 +0200
Subject: [PATCH] Do not report missing utmp record to syslog

If no utmp record can be found there is obviously nobody to read error
message about missing TTY in sytem log in real time. Moreover the log
is usually illegible for normal user. So it's pointless to log this
fact there for user's sake. warnquota can be used instead.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 quota_nld.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/quota_nld.c b/quota_nld.c
index de9504e..5a53b7e 100644
--- a/quota_nld.c
+++ b/quota_nld.c
@@ -264,7 +264,12 @@ static void write_console_warning(struct quota_warning *warn)
 		}
 	}
 	if (!max_atime) {
-		errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
+		/*
+		 * This can happen quite easily so don't spam syslog with
+		 * the error
+		 */
+		if (flags & FL_NODAEMON)
+			errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
 		return;
 	}
 	fd = open(max_dev, O_WRONLY);
-- 
1.7.6