From: Lars Kurth Date: Fri, 1 Sep 2017 20:25:49 +0000 (+0100) Subject: Ensure that --outputfile ./xxx and ../xxx work X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1c08b9e981002d1a0676bc38b9d2eca9261ea8b8;p=people%2Flarsk%2Fxen-release-scripts.git Ensure that --outputfile ./xxx and ../xxx work --- diff --git a/lib/MyOptions.pm b/lib/MyOptions.pm index b48c343..5a50ba2 100755 --- a/lib/MyOptions.pm +++ b/lib/MyOptions.pm @@ -38,7 +38,7 @@ my %optionspec = ( # Applicable to: match-xsa 'xsadir=s' => \$o{'XSADIR'}, - 'xsalist=s' => \$o{'XSALIST'}, + 'xsalist=s' => \$o{'XSALIST'}, 'xsalistdir=s' => \$o{'XSALISTDIR'}, 'not-smart' => \$o{'NOTSMART'}, @@ -83,7 +83,12 @@ sub handleoptions { if (!-d $o{'LOGDIR'}) { mkdir $o{'LOGDIR'}; } - $o{'OUTPUTFILE'} = $o{'LOGROOT'}."/".$o{'SHORT'}."-".$o{'OUTPUTFILE'}; + if ( index($o{'OUTPUTFILE'},"./") == 0 + || index($o{'OUTPUTFILE'},"../") == 0 ) { + $o{'OUTPUTFILE'} = $o{'LOGROOT'}."/".$o{'OUTPUTFILE'}; + } else { + $o{'OUTPUTFILE'} = $o{'LOGROOT'}."/".$o{'SHORT'}."-".$o{'OUTPUTFILE'}; + } $o{'TMPDIR'} = $o{'LOGDIR'}."/tmp"; system("rm -rf ".$o{'TMPDIR'}); mkdir $o{'TMPDIR'};