]> git.proxmox.com Git - pve-access-control.git/commitdiff
do not close STDIN if rune in foreground
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Oct 2011 05:30:44 +0000 (07:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Oct 2011 05:30:44 +0000 (07:30 +0200)
PVE/RPCEnvironment.pm

index 5806107d9e7eb4a0546b503809e371dd170db854..4cacd520f3c8261d1e28d068d110ad17f8ed7f00 100644 (file)
@@ -531,13 +531,17 @@ sub fork_worker {
            # same algorythm as used inside SA
            # STDIN = /dev/null
            my $fd = fileno (STDIN);
-           close STDIN;
-           POSIX::close(0) if $fd != 0;
 
-           die "unable to redirect STDIN - $!" 
-               if !open(STDIN, "</dev/null");
+           if (!$sync) {
+               close STDIN;
+               POSIX::close(0) if $fd != 0;
+
+               die "unable to redirect STDIN - $!" 
+                   if !open(STDIN, "</dev/null");
+
+               $outfh = PVE::Tools::upid_open($upid);
+           }
 
-           $outfh = PVE::Tools::upid_open($upid) if !$sync;
 
            # redirect STDOUT
            $fd = fileno(STDOUT);