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)
This commit is contained in:
antona 2005-10-15 21:26:16 +00:00
parent e46d4e8959
commit b9422552da
2 changed files with 14 additions and 3 deletions

View File

@ -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.

View File

@ -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)