equal
deleted
inserted
replaced
102 # Creation of DB-File if it doesn't exist |
102 # Creation of DB-File if it doesn't exist |
103 # to avoid races we change our own uid/gid for creation of |
103 # to avoid races we change our own uid/gid for creation of |
104 # this file |
104 # this file |
105 if (!-f $db) { |
105 if (!-f $db) { |
106 (my $dir = $db) =~ s/^(.*)\/.*?$/$1/; |
106 (my $dir = $db) =~ s/^(.*)\/.*?$/$1/; |
|
107 |
107 # copy mode, uid, gid from the directory |
108 # copy mode, uid, gid from the directory |
108 my ($mode, $user, $group) = (stat $dir)[2,4,5] or die "Can't stat $dir: $!"; |
109 my ($mode, $user, $group) = (stat $dir)[2,4,5] or die "Can't stat $dir: $!"; |
109 my $umask = umask(($mode & 0777) ^ 0777); |
110 my $umask = umask(($mode & 0777) ^ 0777); |
110 local ($>, $)) = ($user, $group); |
111 local $) = $group; |
|
112 local $> = $user; |
111 open(X, ">>$db") or die "Can't create $db: $!"; |
113 open(X, ">>$db") or die "Can't create $db: $!"; |
112 close(X); |
114 close(X); |
113 umask $umask; |
115 umask $umask; |
114 } |
116 } |
115 |
117 |