# HG changeset patch # User Matti Hamalainen # Date 1288430155 -10800 # Node ID 713879a7ca10e9a0315693e3adc84b93f4ea1a0f # Parent f741718d13c5db39fc78ee0aaba8ddae0081d149 Wait for forked processes, to prevent a zombie apocalypse. diff -r f741718d13c5 -r 713879a7ca10 nnchat.c --- a/nnchat.c Fri Oct 29 23:12:23 2010 +0300 +++ b/nnchat.c Sat Oct 30 12:15:55 2010 +0300 @@ -11,6 +11,8 @@ #ifdef __WIN32 /* Undefine because both windows.h and curses.h #define it */ #undef MOUSE_MOVED +#else +#include #endif #include @@ -578,7 +580,6 @@ /* Open given username's profile via firefox in a new tab */ char *name = trimLeft(buf + 3), *browser = getenv("BROWSER"); - pid_t pid; if (browser == NULL) browser = "firefox"; @@ -589,12 +590,22 @@ snprintf(tmpBuf, sizeof(tmpBuf), "openurl(http://www.newbienudes.com/profile/%s/,new-tab)", tmpStr); th_free(tmpStr); +#ifdef __WIN32 + +#else + { + int status; + pid_t pid; if ((pid = fork()) < 0) { printMsg("Could not create sub-process!\n"); } else if (pid == 0) { execlp(browser, browser, "-remote", tmpBuf, NULL); - exit(errno); + _exit(errno); } + + wait(&status); + } +#endif return 0; } else if (!strncasecmp(buf, "/to ", 4)) { /* Set private messaging target */