aboutsummaryrefslogtreecommitdiff
path: root/archival/bbunzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/bbunzip.c')
-rw-r--r--archival/bbunzip.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 3c3cc2886..4dba498b8 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -20,16 +20,11 @@ enum {
20static 20static
21int open_to_or_warn(int to_fd, const char *filename, int flags, int mode) 21int open_to_or_warn(int to_fd, const char *filename, int flags, int mode)
22{ 22{
23 int fd = open(filename, flags, mode); 23 int fd = open3_or_warn(filename, flags, mode);
24 if (fd < 0) { 24 if (fd < 0) {
25 bb_perror_msg("%s", filename);
26 return 1; 25 return 1;
27 } 26 }
28 if (fd != to_fd) { 27 xmove_fd(fd, to_fd);
29 if (dup2(fd, to_fd) < 0)
30 bb_perror_msg_and_die("cannot dup");
31 close(fd);
32 }
33 return 0; 28 return 0;
34} 29}
35 30