1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00
freebsd-ports/dns/ddclient/files/patch-ddclient
Ryan Steinmetz d7ecc7c232 Update to 1.8.1 [1]
Add LICENSE

PR:		ports/159199
Submitted by:	Rob Farmer <rfarmer@predatorlabs.net> (maintainer) [1]
Approved by:	tabthorpe (mentor)
2011-07-28 21:59:28 +00:00

61 lines
1.7 KiB
Plaintext

--- ./ddclient.orig 2011-07-25 19:41:39.000000000 -0700
+++ ./ddclient 2011-07-25 19:41:48.000000000 -0700
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
#!/usr/local/bin/perl -w
######################################################################
# $Id: ddclient 130 2011-07-11 21:02:07Z wimpunk $
@@ -19,6 +18,7 @@
use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
+use POSIX 'setsid';
my ($VERSION) = q$Revision: 130 $ =~ /(\d+)/;
@@ -668,6 +668,9 @@
;
} elsif (opt('daemon')) {
$SIG{'CHLD'} = 'IGNORE';
+ chdir '/';
+ open(STDIN, "</dev/null");
+ open(STDOUT, ">/dev/null");
my $pid = fork;
if ($pid < 0) {
print STDERR "${program}: can not fork ($!)\n";
@@ -675,10 +678,9 @@
} elsif ($pid) {
exit 0;
}
+ setsid;
$SIG{'CHLD'} = 'DEFAULT';
- open(STDOUT, ">/dev/null");
- open(STDERR, ">/dev/null");
- open(STDIN, "</dev/null");
+ open(STDERR, "&STDOUT");
}
# write out the pid file if we're daemon'ized
@@ -1463,17 +1465,17 @@
## execute the command.
local *FD;
if (! open(FD, $cmd)) {
- printf STDERR "$program: cannot execute command %s.\n", $cmd;
+ warning("$program: cannot execute command %s.\n", $cmd);
} elsif ($stdin && (! print FD "$stdin\n")) {
- printf STDERR "$program: failed writting to %s.\n", $cmd;
+ warning("$program: failed writing to %s.\n", $cmd);
close(FD);
} elsif (! close(FD)) {
- printf STDERR "$program: failed closing %s.($@)\n", $cmd;
+ warning("$program: failed closing %s.($@)\n", $cmd);
} elsif (opt('exec') && $?) {
- printf STDERR "$program: failed %s. ($@)\n", $cmd;
+ warning("$program: failed %s. ($@)\n", $cmd);
} else {
$ok = 1;