]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
kill zombies
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 02:29:34 +0000 (02:29 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 02:29:34 +0000 (02:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13013 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/ivrd.c

index 92687b1c10819f309f8fe26288878998da8e792d..d408139824fcb3eba66b10bb0339d852c006aa3a 100644 (file)
 #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 @@ static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struc
        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 @@ int main(int argc, char *argv[])
                return -1;
        }
 
+       signal(SIGCHLD, SIG_IGN);
+
        esl_listen(ip, port, mycallback);
        
        return 0;