richard: server/perl-kolab/Kolab-Conf Conf.pm.in,1.1,1.2
cvs at intevation.de
cvs at intevation.de
Sat Jan 7 15:46:14 CET 2006
Author: richard
Update of /kolabrepository/server/perl-kolab/Kolab-Conf
In directory doto:/tmp/cvs-serv9550/Kolab-Conf
Modified Files:
Conf.pm.in
Log Message:
Do not crash when a config file does not exists.
Index: Conf.pm.in
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Conf.pm.in 17 Dec 2005 21:45:32 -0000 1.1
+++ Conf.pm.in 7 Jan 2006 14:46:12 -0000 1.2
@@ -817,16 +817,23 @@
foreach $key (keys %templates) {
my $tpl = $templates{$key};
- my $st = stat($tpl);
- my $owner = getpwuid($st->uid).':'.getgrgid($st->gid);
- if( ( ($st->mode & 07777) != $permissions{$tpl}) ||
- ($owner ne $ownership{$tpl}) ) {
- my $str = 'File '.$tpl.' has the wrong persmissions/owner. Found '
- .sprintf("%lo", $st->mode&07777).' '.$owner.', expected '
- .sprintf("%lo",$permissions{$tpl}).' '.$ownership{$tpl};
- print( "$str\n" );
- Kolab::log('T', $str, KOLAB_ERROR );
- $ok = 0;
+
+ if (-r $tpl) {
+ my $st = stat($tpl);
+ my $owner = getpwuid($st->uid).':'.getgrgid($st->gid);
+ if( ( ($st->mode & 07777) != $permissions{$tpl}) ||
+ ($owner ne $ownership{$tpl}) ) {
+ my $str = 'File '.$tpl.' has the wrong persmissions/owner. Found '
+ .sprintf("%lo", $st->mode&07777).' '.$owner.', expected '
+ .sprintf("%lo",$permissions{$tpl}).' '.$ownership{$tpl};
+ print( "$str\n" );
+ Kolab::log('T', $str, KOLAB_ERROR );
+ $ok = 0;
+ }
+ } else {
+ my $str = "File $tpl does not exist";
+ print "$str\n";
+ Kolab::log('T', "$str", KOLAB_ERROR );
}
}
return $ok;
More information about the commits
mailing list