mirror of
https://git.freebsd.org/ports.git
synced 2025-07-03 18:39:16 -04:00
- connect to license framework - add special patch from glarkin to ensure daemon detach from tty, change some printf to use the warning function instead. PR: 148586 Submitted by: Chris Howey <howeyc _at_ gmail.com> Approved by: maintainer, glarkin (mentor)
61 lines
1.7 KiB
Text
61 lines
1.7 KiB
Text
--- ./ddclient.orig 2009-01-27 20:14:02.000000000 +0100
|
|
+++ ./ddclient 2010-08-17 20:13:00.000000000 +0200
|
|
@@ -1,4 +1,3 @@
|
|
-#!/usr/bin/perl -w
|
|
#!/usr/local/bin/perl -w
|
|
######################################################################
|
|
# $Id: ddclient 106 2008-12-04 18:05:23Z wimpunk $
|
|
@@ -19,6 +18,7 @@
|
|
use Getopt::Long;
|
|
use Sys::Hostname;
|
|
use IO::Socket;
|
|
+use POSIX 'setsid';
|
|
|
|
my $version = "3.8.0";
|
|
my $programd = $0;
|
|
@@ -625,6 +625,9 @@
|
|
$SIG{'KILL'} = sub { $caught_kill = 1; };
|
|
if (opt('daemon') && !opt('force')) {
|
|
$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";
|
|
@@ -632,11 +635,10 @@
|
|
} elsif ($pid) {
|
|
exit 0;
|
|
}
|
|
+ setsid;
|
|
$SIG{'CHLD'} = 'DEFAULT';
|
|
$opt{'syslog'} = 1;
|
|
- open(STDOUT, ">/dev/null");
|
|
- open(STDERR, ">/dev/null");
|
|
- open(STDIN, "</dev/null");
|
|
+ open(STDERR, "&STDOUT");
|
|
|
|
write_pid();
|
|
}
|
|
@@ -1404,17 +1406,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;
|