Improved indentation in a few places.
parent
af37e90571
commit
b24f7569df
79
kuvert
79
kuvert
|
@ -96,18 +96,18 @@ if ($options{"k"} || $options{"r"})
|
|||
my @pids=read_file($pidf);
|
||||
for my $p (@pids)
|
||||
{
|
||||
chomp $p;
|
||||
$p=~s/[^0-9]//g; # only numbers
|
||||
# fixme: this is linux-centric, should be replaced
|
||||
# with proc::processtable
|
||||
my $fn="/proc/$p/cmdline";
|
||||
if (-r $fn && (my $n=read_file($fn))=~/^$progname/)
|
||||
{
|
||||
my $s=($n=~/^$listenername/?$ssig:$sig);
|
||||
dlogit("sending sig $s to $p");
|
||||
logit("can't send signal to process $p: $!\n")
|
||||
if (!kill($s,$p));
|
||||
}
|
||||
chomp $p;
|
||||
$p=~s/[^0-9]//g; # only numbers
|
||||
# fixme: this is linux-centric, should be replaced
|
||||
# with proc::processtable
|
||||
my $fn="/proc/$p/cmdline";
|
||||
if (-r $fn && (my $n=read_file($fn))=~/^$progname/)
|
||||
{
|
||||
my $s=($n=~/^$listenername/?$ssig:$sig);
|
||||
dlogit("sending sig $s to $p");
|
||||
logit("can't send signal to process $p: $!\n")
|
||||
if (!kill($s,$p));
|
||||
}
|
||||
}
|
||||
unlink($pidf) if ($options{k}); # remove the pidfile on kills
|
||||
exit 0;
|
||||
|
@ -135,7 +135,7 @@ for my $p (@others)
|
|||
if (-r "/proc/$p/cmdline"
|
||||
&& (my $n=read_file("/proc/$p/cmdline"))=~/^$progname/)
|
||||
{
|
||||
push @badones,$p;
|
||||
push @badones,$p;
|
||||
}
|
||||
}
|
||||
die("other instance(s) with pids ".join(", ",@badones)." are running\n")
|
||||
|
@ -172,11 +172,11 @@ if (!$options{o} && $config{"can-detach"})
|
|||
my $pid=fork;
|
||||
if (!defined $pid)
|
||||
{
|
||||
&bailout("fork failed: $!");
|
||||
&bailout("fork failed: $!");
|
||||
}
|
||||
elsif ($pid)
|
||||
{
|
||||
exit 0; # parent is done
|
||||
exit 0; # parent is done
|
||||
}
|
||||
}
|
||||
print PIDF "$$\n";
|
||||
|
@ -201,30 +201,30 @@ $parser->filer->ignore_filename(1);
|
|||
while (1)
|
||||
{
|
||||
&bailout("cant open $config{queuedir}: $!")
|
||||
if (!opendir(D,"$config{queuedir}"));
|
||||
if (!opendir(D,"$config{queuedir}"));
|
||||
|
||||
my $file;
|
||||
foreach $file (sort grep(/^\d+$/,readdir(D)))
|
||||
{
|
||||
if (!open(FH,"$config{queuedir}/$file"))
|
||||
{
|
||||
logit("huh? $file suddenly disappeared? $!");
|
||||
next;
|
||||
}
|
||||
# lock it if possible
|
||||
if (!flock(FH,LOCK_NB|LOCK_EX))
|
||||
{
|
||||
if (!open(FH,"$config{queuedir}/$file"))
|
||||
{
|
||||
logit("huh? $file suddenly disappeared? $!");
|
||||
next;
|
||||
}
|
||||
# lock it if possible
|
||||
if (!flock(FH,LOCK_NB|LOCK_EX))
|
||||
{
|
||||
close(FH);
|
||||
logit("$file is locked, skipping.");
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
#ok, open & locked, let's proceed
|
||||
logit("processing $file for $username");
|
||||
#ok, open & locked, let's proceed
|
||||
logit("processing $file for $username");
|
||||
|
||||
my @res=process_file(*FH,"$config{queuedir}/$file");
|
||||
if (@res)
|
||||
{
|
||||
my @res=process_file(*FH,"$config{queuedir}/$file");
|
||||
if (@res)
|
||||
{
|
||||
rename("$config{queuedir}/$file","$config{queuedir}/.$file")
|
||||
|| &bailout("cant rename $config{queuedir}/$file: $!");
|
||||
alert("Problem with $config{queuedir}/$file",
|
||||
|
@ -235,18 +235,18 @@ Please review the following error details to determine what went wrong:\n\n",
|
|||
"\n$progname has renamed the problematic mail to \"$config{queuedir}/.$file\";
|
||||
if you want $progname to retry, rename it to an all-numeric filename. Otherwise you should delete the file.\n
|
||||
Please note that processing may have worked for SOME recipients already!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
logit("done handling file $file");
|
||||
unlink("$config{queuedir}/$file")
|
||||
|| &bailout("cant unlink $config{queuedir}/$file: $!");
|
||||
}
|
||||
# and clean up the cruft left behind, please!
|
||||
cleanup("$config{tempdir}",0);
|
||||
}
|
||||
# and clean up the cruft left behind, please!
|
||||
cleanup("$config{tempdir}",0);
|
||||
|
||||
# unlock the file
|
||||
bailout("problem closing $config{queuedir}/$file: $!")
|
||||
# unlock the file
|
||||
bailout("problem closing $config{queuedir}/$file: $!")
|
||||
if (!close(FH));
|
||||
}
|
||||
closedir(D);
|
||||
|
@ -1255,7 +1255,6 @@ sub sign_encrypt
|
|||
{
|
||||
push @cmd,"--detach-sign";
|
||||
}
|
||||
|
||||
if (!$config{"use-agent"})
|
||||
{
|
||||
# now determine which passphrase to query for:
|
||||
|
@ -1285,7 +1284,6 @@ sub sign_encrypt
|
|||
close(F);
|
||||
}
|
||||
push @cmd,"-o",$outfile,$infile;
|
||||
|
||||
# now run gpg, read back stdout/stderr
|
||||
$pid=open(F,"-|");
|
||||
if (!defined $pid)
|
||||
|
@ -1352,7 +1350,6 @@ sub sign_encrypt
|
|||
return (2,"Error: gpg terminated with $?",
|
||||
"Detailed error messages:",@output);
|
||||
}
|
||||
|
||||
if (my @infoline = grep(/^\[GNUPG:\] SIG_CREATED/, @output))
|
||||
{
|
||||
# output format:
|
||||
|
|
Loading…
Reference in New Issue