diff --git a/ChangeLog b/ChangeLog index 3f012666..03e77e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,9 +12,13 @@ xx/xx/2005 - 1.12.2-WIP - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and no ntfs inode in the search context. (Anton) - - Fix compilation on OSX in ntfsresize.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) + - Fix compilation on OSX in ntfsresize.c and 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) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1b31f14f..32734e57 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -387,11 +387,21 @@ static void parse_options(int argc, char **argv) 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) diff --git a/test/Makefile.am b/test/Makefile.am index 09dcfca7..8ea5ea5d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,6 +15,8 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = runlist +EXTRA_DIST = runlist-data + CLEANFILES = attr[123].bin frag[123][123][123] pure-[cn][ms] zero MAINTAINERCLEANFILES = Makefile.in