--------------------- PatchSet 5864 Date: 2003/08/11 19:29:44 Author: serassio Branch: nt-2_5 Tag: (none) Log: Fixed two IPC problems Members: src/ipc.c:1.7.10.10->1.7.10.11 Index: squid/src/ipc.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ipc.c,v retrieving revision 1.7.10.10 retrieving revision 1.7.10.11 diff -u -r1.7.10.10 -r1.7.10.11 --- squid/src/ipc.c 9 Aug 2003 17:44:47 -0000 1.7.10.10 +++ squid/src/ipc.c 11 Aug 2003 19:29:44 -0000 1.7.10.11 @@ -1,6 +1,6 @@ /* - * $Id: ipc.c,v 1.7.10.10 2003/08/09 17:44:47 serassio Exp $ + * $Id: ipc.c,v 1.7.10.11 2003/08/11 19:29:44 serassio Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -593,7 +593,7 @@ { STARTUPINFO si; PROCESS_INFORMATION pi; - fde *F; + long F; memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); @@ -602,14 +602,11 @@ si.hStdError = (HANDLE) _get_osfhandle(2); si.dwFlags = STARTF_USESTDHANDLES; - /* Make sure all other handles are not inerithable */ + /* Make sure all other valid handles are not inerithable */ for (x = 3; x < SQUID_MAXFD; x++) { - F = &fd_table[x]; - if (!F->flags.open) + if ((F = _get_osfhandle(x)) == -1) continue; - if (x == fileno(debug_log)) - continue; - SetHandleInformation((HANDLE) _get_osfhandle(x), HANDLE_FLAG_INHERIT, 0); + SetHandleInformation((HANDLE) F, HANDLE_FLAG_INHERIT, 0); } *buf1 = '\0'; @@ -757,10 +754,11 @@ break; } buf1[x] = '\0'; - if (type == 2 && !strcmp(buf1, shutdown_string)) { + if (type == IPC_UDP_SOCKET && !strcmp(buf1, shutdown_string)) { debug(54, 3) ("ipc(%s,%d): request for shutdown received from parent. Exiting...\n", prog, pid); + TerminateProcess(hProcess, 0); break; } debug(54, 5) ("ipc(%s,%d): received from parent: %s\n", prog, pid, @@ -846,7 +844,7 @@ break; } buf2[x] = '\0'; - if (type == 2 && !strcmp(buf2, shutdown_string)) { + if (type == IPC_UDP_SOCKET && !strcmp(buf2, shutdown_string)) { debug(54, 3) ("ipc(%s,%d): request for shutdown received. Exiting...\n", prog, pid); break;