summaryrefslogtreecommitdiff
path: root/archival/cpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/cpio.c')
-rw-r--r--archival/cpio.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index 41aeef1..f139f31 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -354,10 +354,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
if (*cpio_fmt != 'n') /* we _require_ "-H newc" */
bb_show_usage();
if (opt & CPIO_OPT_FILE) {
- fclose(stdout);
- stdout = fopen_for_write(cpio_filename);
- /* Paranoia: I don't trust libc that much */
- xdup2(fileno(stdout), STDOUT_FILENO);
+ xmove_fd(xopen3(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666), STDOUT_FILENO);
}
dump:
return cpio_o();