Changes by: antona
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21761/ntfsprogs
Modified Files:
ntfsclone.c
Log Message:
- Fix compilation on OSX in ntfsclone.c where stderr = stdout
is not legal (but happens to work on Linux) to do proper
low-level file descriptor mangling which is portable. (Anton)
- Add test/runlist-data to EXTRA_DIST so it gets included in the
distribution otherwise make test fails on released sources. Solution
is not perfect as it also adds the test/runlist-data/CVS directory
but it will do at least for me. (Anton)
Index: ntfsclone.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsclone.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -p -r1.56 -r1.57
--- ntfsclone.c 12 Oct 2005 11:52:41 -0000 1.56
+++ ntfsclone.c 15 Oct 2005 21:44:17 -0000 1.57
@@ -387,11 +387,21 @@ static void parse_options(int argc, char
and for the uncontrollable verbose messages in libntfs. Ughhh. */
if (opt.std_out)
msg_out = stderr;
- else if (opt.debug)
- stderr = stdout;
- else
- if (!(stderr = fopen("/dev/null", "rw")))
- perr_exit("Couldn't open /dev/null");
+ else if (opt.debug) {
+ /* Redirect stderr to stdout, note fflush()es are essential! */
+ fflush(stdout);
+ fflush(stderr);
+ if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) {
+ perror("Failed to redirect stderr to stdout");
+ exit(1);
+ }
+ fflush(stdout);
+ fflush(stderr);
+ } else {
+ fflush(stderr);
+ if (!freopen("/dev/null", "w", stderr))
+ perr_exit("Failed to redirect stderr to /dev/null");
+ }
}
static void progress_init(struct progress_bar *p, u64 start, u64 stop, int res)
|