export: redirect stdout to avoid any unrelated messages ending up in the export stream
Current export implementations luckily seems to not run into this issue yet. However, for the upcoming implementation for RBD, mapping a volume would print the device path to STDOUT, thus messing up the export stream. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
7166db2ce4
commit
9adc4c69ef
@ -315,7 +315,10 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
my $outfh;
|
my $outfh;
|
||||||
if ($filename eq '-') {
|
if ($filename eq '-') {
|
||||||
$outfh = \*STDOUT;
|
# No other messages must go to STDOUT if it's used for the export stream!
|
||||||
|
open($outfh, '>&', STDOUT) or die "unable to dup() STDOUT - $!\n";
|
||||||
|
close(STDOUT);
|
||||||
|
open(STDOUT, '>', '/dev/null');
|
||||||
} else {
|
} else {
|
||||||
sysopen($outfh, $filename, O_CREAT|O_WRONLY|O_TRUNC)
|
sysopen($outfh, $filename, O_CREAT|O_WRONLY|O_TRUNC)
|
||||||
or die "open($filename): $!\n";
|
or die "open($filename): $!\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user