From c279f1a5bd474f002f8486aafbfd0b7f0d4e15c3 Mon Sep 17 00:00:00 2001
From: Andre Noll <maan@systemlinux.org>
Date: Sat, 17 Apr 2010 14:43:00 +0200
Subject: [PATCH] Use logfile only for --run --daemon.

In all other cases it does not really make sense, so it is
better to write log output to stderr in these cases, even if
--logfile was given.
---
 dss.c   | 2 +-
 dss.ggo | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dss.c b/dss.c
index 531beb6..e32e7e2 100644
--- a/dss.c
+++ b/dss.c
@@ -884,7 +884,7 @@ static int parse_config_file(int override)
 			conf.logfile_given = 1;
 		}
 	}
-	if (conf.logfile_given) {
+	if (conf.logfile_given && conf.run_given && conf.daemon_given) {
 		logfile = open_log(conf.logfile_arg);
 		log_welcome(conf.loglevel_arg);
 	}
diff --git a/dss.ggo b/dss.ggo
index 7934db3..8f1ec5c 100644
--- a/dss.ggo
+++ b/dss.ggo
@@ -77,9 +77,10 @@ option "logfile" -
 "Logfile for the dss daemon process"
 string typestr="filename"
 optional
-details="
-	This option is mostly useful for the run command if --daemon
-	is also given.
+details = "
+	This option is only honored if both --run and --daemon are
+	given. Otherwise it is silently ignored and log output is
+	written to stderr.
 "
 
 ##################
-- 
2.39.5