[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH] cpio: use freopen instead of explicit assignment to stdout
From: Aaron Carroll <xaaronc () gmail ! com>
Date: 2009-12-27 5:01:11
Message-ID: 4B36EA17.3080204 () gmail ! com
[Download RAW message or body]
stdout isn't required to be an lvalue, so cpio won't compile
on some implementations.
Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
---
archival/cpio.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/archival/cpio.c b/archival/cpio.c
index 41aeef1..e712173 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -354,8 +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);
+ freopen(cpio_filename, "w", stdout);
/* Paranoia: I don't trust libc that much */
xdup2(fileno(stdout), STDOUT_FILENO);
}
--
1.6.5.6
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic