exim-exigrey.pl
changeset 18 8e9577bcbe71
parent 16 b47059897e9b
child 23 bce276394054
equal deleted inserted replaced
17:43cfd824c314 18:8e9577bcbe71
   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 	local ($>, $)) = (stat $dir)[4,5] or die "Can't stat $dir: $!";
   107 	# 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 $umask = umask(($mode & 0777) ^ 0777);
       
   110 	local ($>, $)) = ($user, $group);
   108 	open(X, ">>$db") or die "Can't create $db: $!";
   111 	open(X, ">>$db") or die "Can't create $db: $!";
   109 	close(X);
   112 	close(X);
       
   113 	umask $umask;
   110     }
   114     }
   111 
   115 
   112     # now test which of the DB-Modules has been loaded
   116     # now test which of the DB-Modules has been loaded
   113 
   117 
   114     if (exists &BerkeleyDB::Hash::TIEHASH) {
   118     if (exists &BerkeleyDB::Hash::TIEHASH) {