Commit 3d4a3e16 authored by olivier.salaun's avatar olivier.salaun
Browse files

[bug][#6380][Reported by M.Warkus, Philipps-Univ. Marburg] Added a line break to written PID files.

Without the linebreak, the init script failed to check process status on OS without /etc/init.d/functions


git-svn-id: https://subversion.renater.fr/sympa/trunk@6069 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent caa589e1
# Makefile.am - Top-level Makefile.am for Sympa # Makefile.am - Top-level Makefile.am for Sympa
# RCS Identication ; $Revision$ ; $Date$ # RCS Identication ; $Revision$ ; $Date$
# #
# Sympa - SYsteme de Multi-Postage Automatique # Sympa - SYsteme de Multi-Postage Automatique
...@@ -90,8 +90,8 @@ importantchanges: ...@@ -90,8 +90,8 @@ importantchanges:
previous=`perl -Mlib=$(DESTDIR)$(bindir) -MVersion -e 'print $$Version::Version'`; \ previous=`perl -Mlib=$(DESTDIR)$(bindir) -MVersion -e 'print $$Version::Version'`; \
fi; \ fi; \
$(PERL) $(top_srcdir)/important_changes.pl \ $(PERL) $(top_srcdir)/important_changes.pl \
--current $(VERSION) \ --current=$(VERSION) \
--previous $${previous}; --previous=$${previous};
uninstall-hook: uninstall-hook:
rm -f $(DESTDIR)$(confdir)/sympa.conf rm -f $(DESTDIR)$(confdir)/sympa.conf
......
...@@ -2259,7 +2259,7 @@ sub remove_pid { ...@@ -2259,7 +2259,7 @@ sub remove_pid {
unless (open(PFILE, ">$pidfile")) { unless (open(PFILE, ">$pidfile")) {
fatal_err('Could not open %s, exiting', $pidfile); fatal_err('Could not open %s, exiting', $pidfile);
} }
print PFILE "$previous_pid"; print PFILE "$previous_pid\n";
close(PFILE); close(PFILE);
}else{ }else{
&do_log('notice','pidfile %s does not exist. Nothing to do.',$pidfile); &do_log('notice','pidfile %s does not exist. Nothing to do.',$pidfile);
...@@ -2327,11 +2327,15 @@ sub write_pid { ...@@ -2327,11 +2327,15 @@ sub write_pid {
} }
## If we can have multiple options for the process. ## If we can have multiple options for the process.
## Print other pids + this one
if($options->{'multiple_process'}){ if($options->{'multiple_process'}){
unless (open(LCK, ">> $pidfile")) { unless (open(LCK, "> $pidfile")) {
fatal_err('Could not open %s, exiting', $pidfile); fatal_err('Could not open %s, exiting', $pidfile);
} }
print LCK "$pid ";
## Print other pids + this one
print LCK "$other_pid $pid\n";
close(LCK); close(LCK);
}else{ }else{
## Create and write the pidfile ## Create and write the pidfile
...@@ -2367,7 +2371,7 @@ sub write_pid { ...@@ -2367,7 +2371,7 @@ sub write_pid {
fatal_err('Could not truncate %s, exiting.', $pidfile); fatal_err('Could not truncate %s, exiting.', $pidfile);
} }
print LCK "$pid "; print LCK "$pid\n";
close(LCK); close(LCK);
} }
unless (&tools::set_file_rights(file => $pidfile, unless (&tools::set_file_rights(file => $pidfile,
...@@ -2481,11 +2485,6 @@ sub remove_dir { ...@@ -2481,11 +2485,6 @@ sub remove_dir {
do_log('debug2','remove_dir()'); do_log('debug2','remove_dir()');
foreach my $current_dir (@_){ foreach my $current_dir (@_){
my @tree = split /\//, $current_dir ;
if ($#tree < 4) {
do_log('err',"$current_dir not removed (not enough / in directory name)");
next;
}
finddepth({wanted => \&del, no_chdir => 1},$current_dir); finddepth({wanted => \&del, no_chdir => 1},$current_dir);
} }
sub del { sub del {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment