diff --git a/ChangeLog b/ChangeLog index 7dd7c838..3f012666 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ 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) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index a38fd5b7..1d1f23a6 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -523,12 +523,20 @@ static int parse_options(int argc, char **argv) } } - stderr = stdout; + /* 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); #ifdef DEBUG if (!opt.debug) - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); + if (!freopen("/dev/null", "w", stderr)) + perr_exit("Failed to redirect stderr to /dev/null"); #endif if (ver)