Microsoft KB Archive/58779

{|
 * width="100%"|

BUG: After Increasing Available File Handles, exec Hangs

 * }

Q58779

5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg kbbuglist -- The information in this article applies to: - The C Run-time (CRT), included with: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SYMPTOMS ======== In Microsoft C, modifying the C Run-time startup code to increase the maximum number of open file handles and streams can cause a program that does multiple exec's to hang. CAUSE ===== There is a known incompatibility between changing the startup source code for the C run-time library and exec'ing multiple child processes. STATUS ====== Microsoft has confirmed this to be a problem in the products and versions listed above. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ The sample code below demonstrates this problem. If you make a copy of this program and call it CHILD.C, and change all references in the CHILD.C program from child to parent, you will have a loop of exec's set up. You can exec the child once, then your machine either hangs on the call to exec the first program again or as the second program is finishing execution. Sample Code --- /* Compile options needed: none */ #define FILES_OPEN 30 #include #include #include #include #include void main ( void ) { short numfiles, returnval; FILE *FilePointer; char fname[80]; for ( numfiles = 0; numfiles < FILES_OPEN; numfiles ++ ) { sprintf ( fname, &quot;file%2d.dat&quot;, numfiles ) ; printf ( &quot;Opening file #%2d :%s\n&quot;, numfiles, fname ) ; if ( ( FilePointer = fopen ( fname, &quot;a+&quot; ) ) == NULL ) { printf ( &quot;fopen failed on file #%2d&quot;, numfiles ) ; exit ( -2 ) ; } } printf ( &quot; Press to quit, other to exec child:\n&quot; ); if ( ( returnval = getche ) == 27 ) { printf ( &quot;Quitting...\n&quot; ) ; exit ( 1 ) ; } if(( returnval=execlp(&quot;child.exe&quot;, &quot;child.exe&quot;, NULL)) == -1) { printf ( &quot;Error exec'ing child; ERRNO: %d\n&quot;, errno ) ; } } Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00 1.00 1.50 P_OVERLAY SPAWN KBCategory: kbprg kbbuglist KBSubcategory: CRTIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCRT