]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: Silence console output entirely with more -q
authorRoy Marples <roy@marples.name>
Thu, 21 May 2020 15:12:25 +0000 (16:12 +0100)
committerRoy Marples <roy@marples.name>
Thu, 21 May 2020 15:12:25 +0000 (16:12 +0100)
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.

src/dhcpcd.8.in
src/dhcpcd.c

index 77b039f14d542f21a5aa290b161a95deeb0b6bdb..59f01166bb1447f7dc2dfebde7a10f328689842f 100644 (file)
@@ -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 @@ only responds to DHCP servers and not BOOTP servers, you can
 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@
index 38702d90e0b10769aa30b847de9cba32c571f17d..1169294b0799b7b8797f719a1129db83d3f0cc4b 100644 (file)
@@ -1900,7 +1900,14 @@ main(int argc, char **argv)
                        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;