From 775df4f8cfa4566db486ea0258494bf260b65184 Mon Sep 17 00:00:00 2001 From: imaginos Date: Sat, 4 Mar 2006 09:25:27 +0000 Subject: [PATCH] switch to execvp, as system() does its own fork and can cause process to detach completely if parent process dies git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@677 726aef4b-f618-498e-8847-2d620e286838 --- FileUtils.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FileUtils.cpp b/FileUtils.cpp index 708d2452..b2be5458 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -342,7 +342,14 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) { dup2(rpipes[1], 2); close(wpipes[0]); close(rpipes[1]); - system( sCommand.c_str() ); + char *pArgv[] = + { + "sh", + "-c", + (char *)sCommand.c_str(), + NULL + }; + execvp( "sh", pArgv ); exit(0); }