Changeset 2654 for branches


Ignore:
Timestamp:
Mar 18, 2006, 5:27:56 AM (19 years ago)
Author:
bird
Message:

Try put the log file handle above the range of the standard handles.

Location:
branches/libc-0.6/src/emx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/ChangeLog.LIBC

    r2652 r2654  
    552006-03-17: knut st. osmundsen <bird-gccos2-spam@anduin.net>
    66    - libc:
     7        o Try put the log file handle above the range of the standard handles
    78        o #71: Fixed incorrect fmutex padding in FILE which cause _fcloseall
    89         (and perhaps others) to crash. (thanks to froloff)
  • branches/libc-0.6/src/emx/src/lib/sys/logstrict.c

    r2647 r2654  
    218218    /*
    219219     * Open the file.
     220     * Make sure the filehandle is above the frequently used range (esp. std handles).
    220221     */
    221222    rc = DosOpen((PCSZ)pszFilename, &pInst->hFile, &ulAction, 0, FILE_NORMAL,
     
    228229        FS_RESTORE();
    229230        return NULL;
     231    }
     232    if (pInst->hFile < 10)
     233    {
     234        int     i;
     235        HFILE   ah[10];
     236        for (i = 0; i < 10; i++)
     237        {
     238            ah[i] = -1;
     239            rc = DosDupHandle(pInst->hFile, &ah[i]);
     240            if (rc)
     241                break;
     242        }
     243        if (i-- > 0)
     244        {
     245            DosClose(pInst->hFile);
     246            pInst->hFile = ah[i];
     247            while (i-- > 0)
     248                DosClose(ah[i]);
     249        }
    230250    }
    231251
Note: See TracChangeset for help on using the changeset viewer.