diff options
Diffstat (limited to 'sysutils/rsnapshot/patches/patch-aa')
-rw-r--r-- | sysutils/rsnapshot/patches/patch-aa | 139 |
1 files changed, 11 insertions, 128 deletions
diff --git a/sysutils/rsnapshot/patches/patch-aa b/sysutils/rsnapshot/patches/patch-aa index 8aff79aba77..6c38aeb1e41 100644 --- a/sysutils/rsnapshot/patches/patch-aa +++ b/sysutils/rsnapshot/patches/patch-aa @@ -1,130 +1,13 @@ -$NetBSD: patch-aa,v 1.3 2005/12/27 08:56:47 kim Exp $ +$NetBSD: patch-aa,v 1.4 2006/10/02 19:51:37 abs Exp $ ---- rsnapshot-program.pl.orig 2005-04-10 01:22:29.000000000 +0300 -+++ rsnapshot-program.pl 2005-12-25 11:16:47.000000000 +0200 -@@ -32,6 +32,7 @@ - use File::Path; # mkpath(), rmtree() - use File::stat; # stat(), lstat() - use POSIX qw(locale_h); # setlocale() -+use Lchown qw(lchown LCHOWN_AVAILABLE); +--- Makefile.in.orig 2006-05-18 11:19:45.000000000 +0100 ++++ Makefile.in +@@ -546,7 +546,7 @@ doc: man html + man: rsnapshot.1 + rsnapshot.1 : rsnapshot + @# perl 5.8 for this +- /usr/bin/pod2man -c '' -n 'rsnapshot' -r '' rsnapshot > rsnapshot.1 ++ pod2man -c '' -n 'rsnapshot' -r '' rsnapshot > rsnapshot.1 - ######################################## - ### DECLARE GLOBAL VARIABLES ### -@@ -3277,24 +3278,9 @@ - - # CHOWN DEST (if root) - if (0 == $<) { -- # make sure destination is not a symlink -- if ( ! -l "$dest" ) { -- # print and/or log this if necessary -- if (($verbose > 4) or ($loglevel > 4)) { -- my $cmd_string = "chown(" . $st->uid . ", " . $st->gid . ", \"$dest\")"; -- -- if ($verbose > 4) { -- print_cmd($cmd_string); -- } elsif ($loglevel > 4) { -- log_msg($cmd_string, 4); -- } -- } -- -- $result = chown($st->uid, $st->gid, "$dest"); -- if (! $result) { -- print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2); -- return(0); -- } -+ $result = safe_chown($st->uid, $st->gid, $dest); -+ if (! $result) { -+ return(0); - } - } - -@@ -3501,6 +3487,43 @@ - return (1); - } - -+# choose between lchown or chown -+sub safe_chown { -+ my $uid = shift(@_); -+ my $gid = shift(@_); -+ my $dest = shift(@_); -+ -+ my $result = 0; -+ -+ # logging -+ if (LCHOWN_AVAILABLE || ! -l $dest) { -+ # print and/or log this if necessary -+ if (($verbose > 4) or ($loglevel > 4)) { -+ my $cmd_string = 'chown(' . $uid . ', ' . $gid . ', "' . $dest . '")'; -+ if ($verbose > 4) { -+ print_cmd($cmd_string); -+ } elsif ($loglevel > 4) { -+ log_msg($cmd_string, 4); -+ } -+ } -+ } -+ -+ if (LCHOWN_AVAILABLE) { -+ $result = lchown($uid, $gid, $dest); -+ } else { -+ # make sure destination is not a symlink -+ if ( ! -l $dest ) { -+ $result = chown($uid, $gid, $dest); -+ } -+ } -+ -+ if (! $result) { -+ print_err('Warning! Could not safe_chown(' . $uid . ', ' . $gid . ', "' . $dest . '")', 2); -+ } -+ -+ return($result); -+} -+ - # accepts a path - # displays the rm command according to the config file - sub display_rm_rf { -@@ -3777,13 +3800,9 @@ - - # CHOWN DEST (if root) - if (0 == $<) { -- # make sure dest is not a symlink -- if ( ! -l "$dest" ) { -- $result = chown($st->uid, $st->gid, "$dest"); -- if (! $result) { -- print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2); -- return(0); -- } -+ $result = safe_chown($st->uid, $st->gid, $dest); -+ if (! $result) { -+ return(0); - } - } - -@@ -3998,25 +4017,9 @@ - # CHOWN DEST (if root) - if (0 == $<) { - if ( -e "$dest" ) { -- # make sure destination is not a symlink -- if ( ! -l "$dest" ) { -- # print and/or log this if necessary -- if (($verbose > 4) or ($loglevel > 4)) { -- my $cmd_string = "chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");"; -- -- if ($verbose > 4) { -- print_cmd($cmd_string); -- } elsif ($loglevel > 4) { -- log_msg($cmd_string, 4); -- } -- } -- -- $result = chown($st->uid, $st->gid, "$dest"); -- -- if (! $result) { -- print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\")", 2); -- return (0); -- } -+ $result = safe_chown($st->uid, $st->gid, $dest); -+ if (! $result) { -+ return (0); - } - } - } + html: rsnapshot.html + rsnapshot.html: rsnapshot |