summaryrefslogtreecommitdiff
path: root/sysutils/rsnapshot/patches/patch-aa
blob: 9ae67a29b49bddad4582eeb6c34f4e0421807016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$NetBSD: patch-aa,v 1.1 2004/10/11 09:44:50 kim Exp $

--- rsnapshot-program.pl.orig	2004-07-05 19:43:18.000000000 -0400
+++ rsnapshot-program.pl	2004-10-11 05:13:15.000000000 -0400
@@ -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);
 
 ########################################
 ###     DECLARE GLOBAL VARIABLES     ###
@@ -2934,7 +2935,11 @@
 			}
 		}
 		
-		$result = chown($st->uid, $st->gid, "$dest");
+		if (Lchown::LCHOWN_AVAILABLE) {
+		    $result = lchown($st->uid, $st->gid, "$dest");
+		} else {
+		    $result = chown($st->uid, $st->gid, "$dest");
+		}
 		if (! $result)	{
 			print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2);
 			return(0);
@@ -3284,7 +3289,11 @@
 	
 	# CHOWN DEST (if root)
 	if (0 == $<)	{
-		$result = chown($st->uid, $st->gid, "$dest");
+		if (Lchown::LCHOWN_AVAILABLE) {
+		    $result = lchown($st->uid, $st->gid, "$dest");
+		} else {
+		    $result = chown($st->uid, $st->gid, "$dest");
+		}
 		if (! $result)	{
 			print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2);
 			return(0);
@@ -3513,7 +3522,11 @@
 				}
 			}
 			
-			$result = chown($st->uid, $st->gid, "$dest");
+			if (Lchown::LCHOWN_AVAILABLE) {
+			    $result = lchown($st->uid, $st->gid, "$dest");
+			} else {
+			    $result = chown($st->uid, $st->gid, "$dest");
+			}
 			
 			if (! $result)	{
 				print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\")", 2);