changeset 5251:50eb48a9b47b draft

dhcpcd: Silence console output entirely with more -q SystemD logs console ouput and syslog to the same place. Pretty daft if you ask me, but heh. -qq disables console output entirely to make SystemD logs easier to read.
author Roy Marples <roy@marples.name>
date Thu, 21 May 2020 16:12:25 +0100
parents 698ca745f939
children bae9ab6cd868
files src/dhcpcd.8.in src/dhcpcd.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.8.in	Thu May 21 15:35:06 2020 +0100
+++ b/src/dhcpcd.8.in	Thu May 21 16:12:25 2020 +0100
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 12, 2020
+.Dd May 21, 2020
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -669,7 +669,9 @@
 Quiet
 .Nm
 on the command line, only warnings and errors will be displayed.
-The messages are still logged though.
+If this option is used another time then all console output is disabled.
+These messages are still logged via
+.Xr syslog 3 .
 .It Fl T , Fl Fl test
 On receipt of DHCP messages just call
 .Pa @SCRIPT@
--- a/src/dhcpcd.c	Thu May 21 15:35:06 2020 +0100
+++ b/src/dhcpcd.c	Thu May 21 16:12:25 2020 +0100
@@ -1900,7 +1900,14 @@
 			i = 4;
 			break;
 		case 'q':
-			logopts |= LOGERR_QUIET;
+			/* -qq disables console output entirely.
+			 * This is important for SystemD because it logs
+			 * both console AND syslog to the same log
+			 * resulting in untold confusion. */
+			if (logopts & LOGERR_QUIET)
+				logopts &= ~LOGERR_ERR;
+			else
+				logopts |= LOGERR_QUIET;
 			break;
 		case 'x':
 			sig = SIGTERM;