# HG changeset patch # User Matti Hamalainen # Date 1300008101 -7200 # Node ID 6b1c67274f6c2c9af612f861a160c2b3d2228e75 # Parent 3140ea43d4a30fa9c5b0529b458992f1d7dbf11b Use a pipe to redirect executed browser's stderr and stdout when opening profiles. diff -r 3140ea43d4a3 -r 6b1c67274f6c nnchat.c --- a/nnchat.c Sun Mar 13 11:21:16 2011 +0200 +++ b/nnchat.c Sun Mar 13 11:21:41 2011 +0200 @@ -718,13 +718,22 @@ #else { int status; + int fds[2]; pid_t pid; snprintf(tmpBuf, sizeof(tmpBuf), "openurl(http://www.newbienudes.com/profile/%s/,new-tab)", tmpStr); th_free(tmpStr); + if (pipe(fds) == -1) { + int ret = errno; + printMsg("Could not open process communication pipe! (%d, %s)\n", ret, strerror(ret)); + return 0; + } + if ((pid = fork()) < 0) { printMsg("Could not create sub-process!\n"); } else if (pid == 0) { + dup2(fds[1], STDOUT_FILENO); + dup2(fds[0], STDERR_FILENO); execlp(setBrowser, setBrowser, "-remote", tmpBuf, (void *)NULL); _exit(errno); }