Fix --enable-logging after VS2013 switch
Fix --enable-logging after VS2013 switch

After https://src.chromium.org/viewvc/chrome?view=rev&revision=178656
a valid fileno of stdout or stderr abort connection of the console to
stdio on Windows.

Looking at the VS CRT between 2010 and 2013, it seems the behavior
that r178656 was relying on changed:

(in __initstdio)

C:\Program Files (x86)>diff "Microsoft Visual Studio 10.0\vc\crt\src\_file.c" "Microsoft Visual Studio 12.0\vc\crt\src\_file.c"
144,157d143
<         for ( i = 0 ; i < 3 ; i++ ) {
<             if ( (_osfhnd(i) == (intptr_t)INVALID_HANDLE_VALUE) ||
<                  (_osfhnd(i) == _NO_CONSOLE_FILENO) ||
<                  (_osfhnd(i) == 0) )
<             {
<             /*
<              * For stdin, stdout & stderr, we use _NO_CONSOLE_FILENO (a value
<              * different from _INVALID_HANDLE_VALUE to distinguish between
<              * a failure in opening a file & a program run without a console.
<              */
<                 _iob[i]._file = _NO_CONSOLE_FILENO;
<             }
<         }
<
194a181
>         __piob = NULL;


There's an open bug

http://connect.microsoft.com/VisualStudio/feedback/details/785119/

but as it was broken in 2012 and not fixed in 2013, it doesn't look like it's
going to be fixed. (The documentation still suggests that r178656 is correct:
http://msdn.microsoft.com/en-us/library/zs6wbdhx(v=vs.100).aspx vs
http://msdn.microsoft.com/en-us/library/zs6wbdhx(v=vs.120).aspx ) but that's
little consolation.

So, confirm that the underlying HANDLE is valid before aborting.

TBR=brettw@chromium.org
R=mseaborn@chromium.org
BUG=169941, 309197, 358267

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=260738

Review URL: https://codereview.chromium.org/219813003

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@261253 0039d316-1c4b-4281-b951-d872f2087c98

ltilve/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,littlstar/chromium.src,Just-D/chromium-1,chuan9/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,markYoungH/chromium.src,dushu1203/chromium.src,markYoungH/chromium.src,dushu1203/chromium.src,ondra-novak/chromium.src,dednal/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,fujunwei/chromium-crosswalk,dushu1203/chromium.src,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,dushu1203/chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,dednal/chromium.src,dednal/chromium.src,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,ltilve/chromium,dednal/chromium.src,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,littlstar/chromium.src,markYoungH/chromium.src,fujunwei/chromium-crosswalk,markYoungH/chromium.src,markYoungH/chromium.src,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dednal/chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,Chilledheart/chromium,axinging/chromium-crosswalk,jaruba/chromium.src,littlstar/chromium.src,M4sse/chromium.src,fujunwei/chromium-crosswalk,dednal/chromium.src,ondra-novak/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk,dushu1203/chromium.src,Chilledheart/chromium,chuan9/chromium-crosswalk,littlstar/chromium.src,TheTypoMaster/chromium-crosswalk,littlstar/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,dednal/chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,M4sse/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,dushu1203/chromium.src,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,ltilve/chromium,axinging/chromium-crosswalk,Fireblend/chromium-crosswalk,littlstar/chromium.src,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,dednal/chromium.src,dednal/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,markYoungH/chromium.src,ondra-novak/chromium.src,M4sse/chromium.src,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,Just-D/chromium-1,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,bright-sparks/chromium-spacewalk,Chilledheart/chromium,M4sse/chromium.src,Chilledheart/chromium,axinging/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,Jonekee/chromium.src,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,jaruba/chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,jaruba/chromium.src,markYoungH/chromium.src,littlstar/chromium.src,krieger-od/nwjs_chromium.src,M4sse/chromium.src,Fireblend/chromium-crosswalk,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,fujunwei/chromium-crosswalk,dushu1203/chromium.src,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,littlstar/chromium.src,ondra-novak/chromium.src,Fireblend/chromium-crosswalk,Chilledheart/chromium,Just-D/chromium-1,markYoungH/chromium.src,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,ltilve/chromium,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,Chilledheart/chromium,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,ondra-novak/chromium.src,Jonekee/chromium.src,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,Chilledheart/chromium,Fireblend/chromium-crosswalk,ltilve/chromium,markYoungH/chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,M4sse/chromium.src