diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index e820b24940a2ad25dddadef16ac358b9433da52b..1e56d7ce7066ed3b9cdf0f9ae743cc7880d81eb5 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
sub check_pid {
$pid = -1;
# Check, if we are already running
- if( open($LOCK_FILE, "<","$pid_file") ) {
+ if( open( my $LOCK_FILE, "<", "$pid_file" ) ) {
$pid = <$LOCK_FILE>;
if( defined $pid ) {
chomp( $pid );
}
}
}
- close( LOCK_FILE );
+ close( $LOCK_FILE );
unlink( $pid_file );
}
# create a syslog msg if it is not to possible to open PID file
- if (not sysopen(LOCK_FILE, $pid_file, O_WRONLY|O_CREAT|O_EXCL, 0644)) {
+ if (not sysopen(my $LOCK_FILE, $pid_file, O_WRONLY|O_CREAT|O_EXCL, 0644)) {
my($msg) = "Couldn't obtain lockfile '$pid_file' ";
- if (open($LOCK_FILE, '<', $pid_file)
+ if (open(my $LOCK_FILE, '<', $pid_file)
&& ($pid = <$LOCK_FILE>))
{
chomp($pid);
&main::daemon_log("$session_id DEBUG: remove an old version of '$result'", 7);
}
- my $fh;
- open($fh, ">","$result");
+ open(my $fh, ">", "$result");
if (not defined $fh) {
&main::daemon_log("$session_id DEBUG: cannot open '$result' for writing", 7);
return undef;
my $line;
- open($CONFIG, "<","$sources_file") or do {
+ open(my $CONFIG, "<", "$sources_file") or do {
daemon_log( "$session_id ERROR: create_packages_list_db: Failed to open '$sources_file'", 1);
unlink($packages_list_under_construction);
return;
};
# Read lines
- while ($line = <CONFIG>){
+ while ($line = <$CONFIG>){
# Unify
chop($line);
$line =~ s/^\s+//;
my ($path, $dist, $srv_path, $session_id)= @_;
if (not defined $session_id) { $session_id = 0;}
my ($package, $version, $section, $description);
- my $PACKAGES;
my $timestamp = &get_time();
if(not stat("$path.in")) {
return;
}
- open($PACKAGES, "<","$path.in");
+ open(my $PACKAGES, "<", "$path.in");
if(not defined($PACKAGES)) {
daemon_log("$session_id ERROR: create_packages_list_db: parse_package: cannot open '$path.in'",1);
return;
my $tmpl= ""; {
local $/=undef;
- open($FILE, "$dir/DEBIAN/templates");
- $tmpl = &encode_base64(<FILE>);
+ open(my $FILE, "$dir/DEBIAN/templates");
+ $tmpl = &encode_base64(<$FILE>);
close($FILE);
}
rmtree("$dir/DEBIAN/templates");
# Do something useful - put our PID into the pid_file
if( 0 != $pid ) {
- open( $LOCK_FILE, ">","$pid_file" );
+ open( my $LOCK_FILE, ">", "$pid_file" );
print $LOCK_FILE "$pid\n";
close( $LOCK_FILE );
if( !$foreground ) {
# Prepare log file and set permissions
$root_uid = getpwnam('root');
$adm_gid = getgrnam('adm');
-open($FH, ">>","$log_file");
+open(my $FH, ">>", "$log_file");
close($FH);
chmod(0440, $log_file);
chown($root_uid, $adm_gid, $log_file);