mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 17:25:03 +02:00
respect POCO_NO_FORK_EXEC in ServerApplication
This commit is contained in:
parent
5184a8526f
commit
1debe07a2d
@ -682,6 +682,7 @@ bool ServerApplication::isDaemon(int argc, char** argv)
|
|||||||
|
|
||||||
void ServerApplication::beDaemon()
|
void ServerApplication::beDaemon()
|
||||||
{
|
{
|
||||||
|
#if !defined(POCO_NO_FORK_EXEC)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
if ((pid = fork()) < 0)
|
if ((pid = fork()) < 0)
|
||||||
throw SystemException("cannot fork daemon process");
|
throw SystemException("cannot fork daemon process");
|
||||||
@ -701,6 +702,9 @@ void ServerApplication::beDaemon()
|
|||||||
if (!fout) throw Poco::OpenFileException("Cannot attach stdout to /dev/null");
|
if (!fout) throw Poco::OpenFileException("Cannot attach stdout to /dev/null");
|
||||||
FILE* ferr = freopen("/dev/null", "r+", stderr);
|
FILE* ferr = freopen("/dev/null", "r+", stderr);
|
||||||
if (!ferr) throw Poco::OpenFileException("Cannot attach stderr to /dev/null");
|
if (!ferr) throw Poco::OpenFileException("Cannot attach stderr to /dev/null");
|
||||||
|
#else
|
||||||
|
throw Poco::NotImplementedException("platform does not allow fork/exec");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user