Ignore:
Timestamp:
Sep 9, 2012, 7:21:48 PM (13 years ago)
Author:
bird
Message:

kash: Fixes for hash-bang-scripts on windows. Related debug tracing fix. Another CWD slash fix. Fixed a couple of assertions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/shinstance.c

    r2648 r2652  
    598598#ifdef _MSC_VER
    599599        if (signal(signo, g_sig_state[signo].sa.sa_handler) == SIG_ERR)
     600        {
     601            TRACE2((psh, "sh_sigaction: SIG_ERR, errno=%d signo=%d\n", errno, signo));
     602            if (   signo != SIGHUP   /* whatever */
     603                && signo != SIGQUIT
     604                && signo != SIGPIPE
     605                && signo != SIGTTIN
     606                && signo != SIGTSTP
     607                && signo != SIGTTOU
     608                && signo != SIGCONT)
     609                assert(0);
     610        }
    600611#else
    601612        if (sigaction(signo, &g_sig_state[signo].sa, NULL))
    602 #endif
    603613            assert(0);
     614#endif
    604615
    605616        shmtx_leave(&g_sh_mtx, &tmp);
     
    11811192            errno = EINVAL;
    11821193        }
     1194        else
     1195        {
     1196            DWORD dwErr = GetLastError();
     1197            switch (dwErr)
     1198            {
     1199                case ERROR_FILE_NOT_FOUND:          errno = ENOENT; break;
     1200                case ERROR_PATH_NOT_FOUND:          errno = ENOENT; break;
     1201                case ERROR_BAD_EXE_FORMAT:          errno = ENOEXEC; break;
     1202                case ERROR_INVALID_EXE_SIGNATURE:   errno = ENOEXEC; break;
     1203                default:
     1204                    errno = EINVAL;
     1205                    break;
     1206            }
     1207            TRACE2((psh, "sh_execve: dwErr=%d -> errno=%d\n", dwErr, errno));
     1208        }
    11831209
    11841210        shfile_exec_win(&psh->fdtab, 0 /* done */, NULL, NULL);
Note: See TracChangeset for help on using the changeset viewer.