Commit dd36d5ab authored by Leigh Stoller's avatar Leigh Stoller

Fix up the logname creation to work when there is a log file from a

previous attempt.
parent b285b710
......@@ -463,18 +463,32 @@ sub CreateLogFile($$$)
my $pid = $self->pid();
my $projroot = PROJROOT();
my $logdir = "$projroot/$pid/templates/logs";
my $logname = "$logdir/$prefix.${guid}-${vers}.log";
return -1
if (-e $logname);
my $linkname = "$logdir/$prefix.${guid}-${vers}.log";
return -1
if (! -d $logdir && !mkdir($logdir, 0775));
my $logname = `mktemp $logdir/$prefix.${guid}-${vers}.XXXXXX`;
if ($logname =~ /^([-\@\w\.\/]+)$/) {
$logname = $1;
}
else {
return -1;
}
if (-e $linkname) {
return -1
if (! unlink($linkname));
}
Template::mysystem("touch $logname") == 0
or return -1;
$$ppath = $logname;
if (! link($logname, $linkname)) {
print STDERR "*** Cannot link $logname,$linkname: $!\n";
return -1;
}
$$ppath = $linkname;
return 0;
}
......
Markdown is supported
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