added a new parameter 'close_files' to App::daemonize()
This commit is contained in:
parent
bb0fc4944d
commit
d3a04da539
@ -86,7 +86,7 @@ public:
|
|||||||
return this->_cmgr;
|
return this->_cmgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int daemonize (bool chdir_to_root = true, int fork_count = 1, bool root_only = false) QSE_CPP_NOEXCEPT;
|
int daemonize (bool chdir_to_root = true, int fork_count = 1, bool root_only = false, bool close_files = true) QSE_CPP_NOEXCEPT;
|
||||||
|
|
||||||
int chroot (const qse_mchar_t* mpath) QSE_CPP_NOEXCEPT;
|
int chroot (const qse_mchar_t* mpath) QSE_CPP_NOEXCEPT;
|
||||||
int chroot (const qse_wchar_t* wpath) QSE_CPP_NOEXCEPT;
|
int chroot (const qse_wchar_t* wpath) QSE_CPP_NOEXCEPT;
|
||||||
|
@ -129,7 +129,7 @@ void App::setName (const qse_char_t* name) QSE_CPP_NOEXCEPT
|
|||||||
qse_log_setident (&this->_log.logger, name);
|
qse_log_setident (&this->_log.logger, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int App::daemonize (bool chdir_to_root, int fork_count, bool root_only) QSE_CPP_NOEXCEPT
|
int App::daemonize (bool chdir_to_root, int fork_count, bool root_only, bool close_files) QSE_CPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (root_only && QSE_GETEUID() != 0) return -1;
|
if (root_only && QSE_GETEUID() != 0) return -1;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ int App::daemonize (bool chdir_to_root, int fork_count, bool root_only) QSE_CPP_
|
|||||||
QSE_UMASK (0);
|
QSE_UMASK (0);
|
||||||
if (chdir_to_root) QSE_CHDIR("/"); // don't care about failure
|
if (chdir_to_root) QSE_CHDIR("/"); // don't care about failure
|
||||||
|
|
||||||
if (true)
|
if (close_files)
|
||||||
{
|
{
|
||||||
int keep[] = { 0, 1, 2};
|
int keep[] = { 0, 1, 2};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user