4c13f89
From 7d2ac8097d65c6698124abd2dda25bffd8590aa7 Mon Sep 17 00:00:00 2001
4c13f89
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
4c13f89
Date: Wed, 17 Aug 2011 16:16:12 +0200
4c13f89
Subject: [PATCH] Do not report missing utmp record to syslog
4c13f89
4c13f89
If no utmp record can be found there is obviously nobody to read error
4c13f89
message about missing TTY in sytem log in real time. Moreover the log
4c13f89
is usually illegible for normal user. So it's pointless to log this
4c13f89
fact there for user's sake. warnquota can be used instead.
4c13f89
4c13f89
Signed-off-by: Jan Kara <jack@suse.cz>
4c13f89
---
4c13f89
 quota_nld.c |    7 ++++++-
4c13f89
 1 files changed, 6 insertions(+), 1 deletions(-)
4c13f89
4c13f89
diff --git a/quota_nld.c b/quota_nld.c
4c13f89
index de9504e..5a53b7e 100644
4c13f89
--- a/quota_nld.c
4c13f89
+++ b/quota_nld.c
4c13f89
@@ -264,7 +264,12 @@ static void write_console_warning(struct quota_warning *warn)
4c13f89
 		}
4c13f89
 	}
4c13f89
 	if (!max_atime) {
4c13f89
-		errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
4c13f89
+		/*
4c13f89
+		 * This can happen quite easily so don't spam syslog with
4c13f89
+		 * the error
4c13f89
+		 */
4c13f89
+		if (flags & FL_NODAEMON)
4c13f89
+			errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
4c13f89
 		return;
4c13f89
 	}
4c13f89
 	fd = open(max_dev, O_WRONLY);
4c13f89
-- 
4c13f89
1.7.6
4c13f89