diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-02 20:49:22 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-02 20:49:22 +0300 |
commit | c066472b0cfba62260ccb86d567a11c8b3d395e3 (patch) | |
tree | 7e7827ab2a317eebeb1add39179790c62bc34e4f /archival | |
parent | 1ee5afdce28d5a11987071f710c1d2fd493618cc (diff) |
*: do not assign to stdout/stderr, it's not portable.
Based on patch by Aaron Carroll <xaaronc@gmail.com>
function old new delta
time_main 1062 1052 -10
cpio_main 563 549 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/cpio.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index 41aeef171..f139f3130 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(); |