]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Ensure that --outputfile ./xxx and ../xxx work
authorLars Kurth <lars.kurth@citrix.com>
Fri, 1 Sep 2017 20:25:49 +0000 (21:25 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Fri, 1 Sep 2017 20:25:49 +0000 (21:25 +0100)
lib/MyOptions.pm

index b48c343edd7991965ea9ff28200a9f144dcf58c9..5a50ba2cc3cc721f300cbe731515b02c47c189f0 100755 (executable)
@@ -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'};