Revert 276039 "Another try at fixing --enable-logging on Windows"
Speculative revert for XP failures (based on bug history)
http://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%281%29/builds/31536
> Another try at fixing --enable-logging on Windows
>
> Per details logged on connect bug and crbug, when linked as a Windows
> subsystem binary, the _fileno() for stdin/stdout/stderr are incorrectly set
> to 0,1,2 rather than all -2 (because there's no console attached). This
> was broken between VS2010->VS2012 and is still broken in the latest VS2013
> update.
>
> So, instead of only checking _fileno, we also check the underlying HANDLE
> to confirm that it's valid for that stream before aborting.
>
> BUG=358267
> BUG=https://connect.microsoft.com/VisualStudio/feedback/details/785119/#tabs
>
> Review URL: https://codereview.chromium.org/324493003
TBR=scottmg@chromium.org
Review URL: https://codereview.chromium.org/327023002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276123 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc
index 66e68e2..9e4db38 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -64,17 +64,7 @@
// stdout/stderr on startup (before the handle IDs can be reused).
// _fileno(stdout) will return -2 (_NO_CONSOLE_FILENO) if stdout was
// invalid.
-
- // TODO(scottmg):
- // Unfortunately _fileno was broken in VS2012, and is still broken in VS2013.
- // https://connect.microsoft.com/VisualStudio/feedback/details/785119/
- // http://crbug.com/358267
- // It never returns -2 as it is documented to do (and per above) when in a
- // windowed application without a console. As a result, we have to use
- // GetStdHandle, even though it's not strictly correct. Hopefully this can
- // be removed after a future revision of the CRT.
- if ((_fileno(stdout) >= 0 && GetStdHandle(STD_OUTPUT_HANDLE) != NULL) ||
- (_fileno(stderr) >= 0 && GetStdHandle(STD_ERROR_HANDLE)) != NULL)
+ if (_fileno(stdout) >= 0 || _fileno(stderr) >= 0)
return;
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {