Ignore:
Timestamp:
Mar 19, 2018, 2:37:13 PM (8 years ago)
Author:
bird
Message:

kmk/win: Some fixes & docs.

Location:
trunk/src/kmk/kmkbuiltin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmkbuiltin/append.c

    r3141 r3159  
    190190
    191191    /*
    192      * Open the output file.
     192     * Open the output file, preferrably with close-on-exec.
    193193     */
    194194    iFile = i;
    195     pFile = fopen(argv[i], fTruncate ? "w" : "a");
     195    pFile = fopen(argv[i],
     196                  fTruncate ? "w" KMK_FOPEN_NO_INHERIT_MODE
     197                            : "a" KMK_FOPEN_NO_INHERIT_MODE);
    196198    if (!pFile)
    197199        return err(1, "failed to open '%s'", argv[i]);
  • trunk/src/kmk/kmkbuiltin/kDepIDB.c

    r2955 r3159  
    732732                        pOutput = stdout;
    733733                    else
    734                         pOutput = fopen(pszOutput, "w");
     734                        pOutput = fopen(pszOutput, "w" KMK_FOPEN_NO_INHERIT_MODE);
    735735                    if (!pOutput)
    736736                    {
     
    812812        else
    813813        {
    814             pInput = fopen(argv[i], "rb");
     814            pInput = fopen(argv[i], "rb" KMK_FOPEN_NO_INHERIT_MODE);
    815815            if (!pInput)
    816816            {
  • trunk/src/kmk/kmkbuiltin/md5sum.c

    r3131 r3159  
    156156
    157157    errno = 0;
    158     pFile = fopen(pszFilename, fText ? "r" : "rb");
     158    pFile = fopen(pszFilename,
     159                  fText ? "r"  KMK_FOPEN_NO_INHERIT_MODE
     160                        : "rb" KMK_FOPEN_NO_INHERIT_MODE);
    159161    if (!pFile && errno == EINVAL && !fText)
    160         pFile = fopen(pszFilename, "r");
     162        pFile = fopen(pszFilename, "r" KMK_FOPEN_NO_INHERIT_MODE);
    161163    return pFile;
    162164
     
    472474     * Try open the md5.lst file and process it line by line.
    473475     */
    474     pFile = fopen(pszFilename, "r");
     476    pFile = fopen(pszFilename, "r" KMK_FOPEN_NO_INHERIT_MODE);
    475477    if (pFile)
    476478    {
     
    837839                if (pOutput)
    838840                    fclose(pOutput);
    839                 pOutput = fopen(pszOutput, "w");
     841                pOutput = fopen(pszOutput, "w" KMK_FOPEN_NO_INHERIT_MODE);
    840842                if (!pOutput)
    841843                {
    842                     rc = err(1, "fopen(\"%s\", \"w\") failed", pszOutput);
     844                    rc = err(1, "fopen(\"%s\", \"w" KMK_FOPEN_NO_INHERIT_MODE "\") failed", pszOutput);
    843845                    break;
    844846                }
  • trunk/src/kmk/kmkbuiltin/redirect.c

    r3156 r3159  
    878878             */
    879879            FILE *pWorkingStdErr = NULL;
     880# if defined(CONFIG_NEW_WIN_CHILDREN) && defined(KMK)
     881            if (cOrders > 0)
     882                MkWinChildExclusiveAcquire();
     883# endif
    880884            rcExit = kRedirectExecFdOrders(cOrders, paOrders, &pWorkingStdErr);
    881885            if (rcExit == 0)
     
    890894                HANDLE  hProcess = (HANDLE)_spawnvpe(_P_NOWAIT, pszExecutable, papszArgs, papszEnvVars);
    891895                kRedirectRestoreFdOrders(cOrders, paOrders, &pWorkingStdErr);
     896# ifdef CONFIG_NEW_WIN_CHILDREN
     897                if (cOrders > 0)
     898                    MkWinChildExclusiveRelease();
     899# endif
    892900                if ((intptr_t)hProcess != -1)
    893901                {
     
    10151023#endif /* !KMK */
    10161024            }
     1025#if defined(CONFIG_NEW_WIN_CHILDREN) && defined(KBUILD_OS_WINDOWS) && defined(KMK)
     1026            else if (cOrders > 0)
     1027                MkWinChildExclusiveRelease();
     1028#endif
     1029
    10171030        }
    10181031
Note: See TracChangeset for help on using the changeset viewer.