summary refs log tree commit diff
path: root/pkgs/tools/networking/ddclient
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-04-19 12:09:32 +0300
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-04-19 12:32:04 +0300
commit7532c5379d02fb012fa42190424a46bdb033efcc (patch)
tree44e6c13010551d806dd6c2259b8e1438aedea821 /pkgs/tools/networking/ddclient
parent4e51a466bdfa260d15fbaafe52cdccf5280f13d1 (diff)
downloadnixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar.gz
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar.bz2
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar.lz
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar.xz
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.tar.zst
nixpkgs-7532c5379d02fb012fa42190424a46bdb033efcc.zip
ddclient: Force line buffering on stdout
Status messages of ddclient go to stdout, which is block buffered by
default, so most of its output won't appear in the journal until it is
exiting:

-- Reboot --
Apr 19 11:31:04 xen systemd[1]: Starting Dynamic DNS Client...
Apr 19 11:31:04 xen systemd[1]: Started Dynamic DNS Client.
Apr 19 11:31:53 xen systemd[1]: Stopping Dynamic DNS Client...
Apr 19 11:31:53 xen ddclient[530]: === opt ====
Apr 19 11:31:53 xen ddclient[530]: opt{cache}                           : <undefined>
Apr 19 11:31:53 xen ddclient[530]: opt{cmd}                             : <undefined>
...

Fix this by adding a patch to set line buffering on stdout.
Diffstat (limited to 'pkgs/tools/networking/ddclient')
-rw-r--r--pkgs/tools/networking/ddclient/ddclient-line-buffer-stdout.patch20
-rw-r--r--pkgs/tools/networking/ddclient/default.nix2
2 files changed, 21 insertions, 1 deletions
diff --git a/pkgs/tools/networking/ddclient/ddclient-line-buffer-stdout.patch b/pkgs/tools/networking/ddclient/ddclient-line-buffer-stdout.patch
new file mode 100644
index 00000000000..d1ef9e024d2
--- /dev/null
+++ b/pkgs/tools/networking/ddclient/ddclient-line-buffer-stdout.patch
@@ -0,0 +1,20 @@
+diff -u ddclient-3.8.1/ddclient ddclient-3.8.1.patched/ddclient
+--- ddclient-3.8.1/ddclient	2011-07-11 23:04:21.000000000 +0200
++++ ddclient-3.8.1.patched/ddclient	2012-11-08 11:52:31.930647236 +0100
+@@ -19,6 +19,7 @@ use strict;
+ use Getopt::Long;
+ use Sys::Hostname;
+ use IO::Socket;
++use IO::Handle qw( );
+ 
+ my ($VERSION) = q$Revision: 157 $ =~ /(\d+)/;
+ 
+@@ -675,7 +676,7 @@ $SIG{'TERM'}   = sub { $caught_term = 1; };
+ $SIG{'KILL'}   = sub { $caught_kill = 1; };
+ # don't fork() if foreground or force is on
+ if (opt('foreground') || opt('force')) {
+-    ;
++    STDOUT->autoflush(1);
+ } elsif (opt('daemon')) {
+     $SIG{'CHLD'}   = 'IGNORE';
+     my $pid = fork;
diff --git a/pkgs/tools/networking/ddclient/default.nix b/pkgs/tools/networking/ddclient/default.nix
index fdc5e145c4d..41688d84351 100644
--- a/pkgs/tools/networking/ddclient/default.nix
+++ b/pkgs/tools/networking/ddclient/default.nix
@@ -10,7 +10,7 @@ buildPerlPackage {
 
   buildInputs = [ perlPackages.IOSocketSSL perlPackages.DigestSHA1 ];
 
-  patches = [ ./ddclient-foreground.patch ];
+  patches = [ ./ddclient-foreground.patch ./ddclient-line-buffer-stdout.patch ];
 
   # Use iproute2 instead of ifconfig
   preConfigure = ''