Changeset 3441 in kBuild
- Timestamp:
- Sep 10, 2020 11:54:53 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shinstance.c
r3439 r3441 67 67 * Global Variables * 68 68 *********************************************************************************************************************************/ 69 #ifndef SH_FORKED_MODE 70 /** Mutex serializing exec/spawn to prevent unwanted file inherting. */ 71 static shmtx g_sh_exec_mtx; 72 #endif 69 73 /** The mutex protecting the the globals and some shell instance members (sigs). */ 70 74 static shmtx g_sh_mtx; … … 640 644 assert(g_sh_mtx.au64[SHMTX_MAGIC_IDX] != SHMTX_MAGIC); 641 645 shmtx_init(&g_sh_mtx); 646 #ifndef SH_FORKED_MODE 647 shmtx_init(&g_sh_exec_mtx); 648 #endif 642 649 643 650 psh = sh_create_shell_common(argv, envp, NULL /*parentfdtab*/); … … 785 792 && item[len] == '=') 786 793 return (char *)item + len + 1; 794 i++; 787 795 } 788 796 … … 1650 1658 shfile_uninit(&psh->fdtab); 1651 1659 sh_int_unlink(psh); 1660 /** @todo */ 1652 1661 } 1653 1662 … … 1698 1707 * This ain't quite straight forward on Windows... 1699 1708 */ 1709 #ifndef SH_FORKED_MODE 1710 shmtxtmp tmp; 1711 #endif 1700 1712 PROCESS_INFORMATION ProcInfo; 1701 1713 STARTUPINFO StrtInfo; … … 1809 1821 1810 1822 /* File handles. */ 1823 #ifndef SH_FORKED_MODE 1824 shmtx_enter(&g_sh_exec_mtx, &tmp); 1825 #endif 1811 1826 StrtInfo.dwFlags |= STARTF_USESTDHANDLES; 1812 1827 StrtInfo.lpReserved2 = shfile_exec_win(&psh->fdtab, 1 /* prepare */, &StrtInfo.cbReserved2, hndls); … … 1816 1831 1817 1832 /* Get going... */ 1818 if (CreateProcess(exe, 1819 cmdline, 1820 NULL, /* pProcessAttributes */ 1821 NULL, /* pThreadAttributes */ 1822 TRUE, /* bInheritHandles */ 1823 0, /* dwCreationFlags */ 1824 envblock, 1825 cwd, 1826 &StrtInfo, 1827 &ProcInfo)) 1833 rc = CreateProcess(exe, 1834 cmdline, 1835 NULL, /* pProcessAttributes */ 1836 NULL, /* pThreadAttributes */ 1837 TRUE, /* bInheritHandles */ 1838 0, /* dwCreationFlags */ 1839 envblock, 1840 cwd, 1841 &StrtInfo, 1842 &ProcInfo); 1843 1844 shfile_exec_win(&psh->fdtab, 0 /* done */, NULL, NULL); 1845 #ifndef SH_FORKED_MODE 1846 shmtx_leave(&g_sh_exec_mtx, &tmp); 1847 #endif 1848 if (rc) 1828 1849 { 1829 1850 DWORD dwErr; … … 1837 1858 { 1838 1859 CloseHandle(ProcInfo.hProcess); 1839 _exit(dwExitCode);1860 sh__exit(psh, dwExitCode); 1840 1861 } 1862 TRACE2((psh, "sh_execve: GetExitCodeProcess failed: %u\n", GetLastError())); 1863 assert(0); 1864 CloseHandle(ProcInfo.hProcess); 1841 1865 errno = EINVAL; 1842 1866 } … … 1857 1881 } 1858 1882 1859 shfile_exec_win(&psh->fdtab, 0 /* done */, NULL, NULL);1860 1883 } 1861 1884 rc = -1;
Note:
See TracChangeset
for help on using the changeset viewer.