aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-08-23 12:47:56 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-08-23 12:47:56 +0000
commit5502f298dad51b1c7d627f3e4c99af7879ac2a4b (patch)
tree47ff8190968feddb15ed3e91873921c023458e6f
parentc7d3339ce2b00c7c6c1e39b64c5fed5df9e03a32 (diff)
downloadrpmtools-5502f298dad51b1c7d627f3e4c99af7879ac2a4b.tar
rpmtools-5502f298dad51b1c7d627f3e4c99af7879ac2a4b.tar.gz
rpmtools-5502f298dad51b1c7d627f3e4c99af7879ac2a4b.tar.bz2
rpmtools-5502f298dad51b1c7d627f3e4c99af7879ac2a4b.tar.xz
rpmtools-5502f298dad51b1c7d627f3e4c99af7879ac2a4b.zip
If extracting an archive to an undefined directory, output to stdout.
(used by urpmq)
-rw-r--r--Packdrakeng.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/Packdrakeng.pm b/Packdrakeng.pm
index f3bd344..6a7e616 100644
--- a/Packdrakeng.pm
+++ b/Packdrakeng.pm
@@ -602,10 +602,15 @@ sub extract {
next; # Don't overwrite a file because where the symlink point to
};
}
- sysopen(my $destfh, $dest, O_CREAT | O_TRUNC | O_WRONLY) or do {
- $pack->{log}("Unable to extract $dest");
- next;
- };
+ my $destfh;
+ if (defined $destdir) {
+ sysopen($destfh, $dest, O_CREAT | O_TRUNC | O_WRONLY) or do {
+ $pack->{log}("Unable to extract $dest");
+ next;
+ };
+ } else {
+ $destfh = \*STDOUT;
+ }
my $written = $pack->extract_virtual($destfh, $f);
$written == -1 and $pack->{log}("Unable to extract file $f");
close($destfh);