Author: anthm Date: Mon Apr 13 21:29:34 2009 New Revision: 13013 Log: kill zombies Modified: freeswitch/trunk/libs/esl/ivrd.c Modified: freeswitch/trunk/libs/esl/ivrd.c ============================================================================== --- freeswitch/trunk/libs/esl/ivrd.c (original) +++ freeswitch/trunk/libs/esl/ivrd.c Mon Apr 13 21:29:34 2009 @@ -35,22 +35,25 @@ #include <stdlib.h> #include <esl.h> + static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { esl_handle_t handle = {{0}}; char path_buffer[1024] = { 0 }; const char *path; - + if (fork()) { close(client_sock); return; } + esl_attach_handle(&handle, client_sock, addr); if (!(path = esl_event_get_header(handle.info_event, "variable_ivr_path"))) { + esl_disconnect(&handle); esl_log(ESL_LOG_ERROR, "Missing ivr_path param!\n"); - return; + exit(0); } strncpy(path_buffer, path, sizeof(path_buffer) - 1); @@ -63,12 +66,10 @@ handle.sock = -1; esl_disconnect(&handle); - /* DOH! we're still here! Close the socket. */ - execl(path_buffer, path_buffer, NULL); - esl_log(ESL_LOG_ERROR, "Error %d\n", client_sock); + //system(path_buffer); close(client_sock); - + exit(0); } int main(int argc, char *argv[]) @@ -92,6 +93,8 @@ return -1; } + signal(SIGCHLD, SIG_IGN); + esl_listen(ip, port, mycallback); return 0;
participants (1)
-
FreeSWITCH SVN