apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1539455 - /apr/apr/trunk/file_io/win32/filedup.c
Date Wed, 06 Nov 2013 20:48:18 GMT
Author: trawick
Date: Wed Nov  6 20:48:18 2013
New Revision: 1539455

URL: http://svn.apache.org/r1539455
Log:
Windows: Fix debug RTL assertion when attempting to _commit(stdout)
or _commit(stderr).

Submitted by: Mike Rumph <mike.rumph oracle.com>
Reviewed by trawick, who adjusted the patch to remove the existing _commit(stdin)

Modified:
    apr/apr/trunk/file_io/win32/filedup.c

Modified: apr/apr/trunk/file_io/win32/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filedup.c?rev=1539455&r1=1539454&r2=1539455&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filedup.c (original)
+++ apr/apr/trunk/file_io/win32/filedup.c Wed Nov  6 20:48:18 2013
@@ -88,7 +88,9 @@ APR_DECLARE(apr_status_t) apr_file_dup2(
              */
             fflush(stderr);
             setvbuf(stderr, NULL, _IONBF, 0);
-            _commit(2 /* stderr */);
+            if (!_isatty(2)) {
+                _commit(2 /* stderr */);
+            }
 
             /* Clone a handle can _close() without harming the source handle,
              * open an MSVCRT-based pseudo-fd for the file handle, then dup2
@@ -118,7 +120,9 @@ APR_DECLARE(apr_status_t) apr_file_dup2(
             /* For the process flow see the stderr case above */
             fflush(stdout);
             setvbuf(stdout, NULL, _IONBF, 0);
-            _commit(1 /* stdout */);
+            if (!_isatty(1)) {
+                _commit(1 /* stdout */);
+            }
 
             if (!DuplicateHandle(hproc, old_file->filehand, hproc, &newhand,
                                  0, FALSE, DUPLICATE_SAME_ACCESS)) {
@@ -134,7 +138,6 @@ APR_DECLARE(apr_status_t) apr_file_dup2(
             /* For the process flow see the stderr case above */
             fflush(stdin);
             setvbuf(stdin, NULL, _IONBF, 0);
-            _commit(0 /* stdin */);
 
             if (!DuplicateHandle(hproc, old_file->filehand, hproc, &newhand,
                                  0, FALSE, DUPLICATE_SAME_ACCESS)) {



Mime
View raw message