mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
added closing descriptors in enotify module
This commit is contained in:
@ -243,7 +243,7 @@ static ngx_int_t
|
|||||||
ngx_rtmp_enotify_exec(ngx_rtmp_session_t *s, ngx_rtmp_enotify_conf_t *ec)
|
ngx_rtmp_enotify_exec(ngx_rtmp_session_t *s, ngx_rtmp_enotify_conf_t *ec)
|
||||||
{
|
{
|
||||||
#if !(NGX_WIN32)
|
#if !(NGX_WIN32)
|
||||||
int pid, fd;
|
int pid, fd, maxfd;
|
||||||
ngx_str_t a, *arg;
|
ngx_str_t a, *arg;
|
||||||
char **args;
|
char **args;
|
||||||
ngx_uint_t n;
|
ngx_uint_t n;
|
||||||
@ -258,6 +258,13 @@ ngx_rtmp_enotify_exec(ngx_rtmp_session_t *s, ngx_rtmp_enotify_conf_t *ec)
|
|||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
/* child */
|
/* child */
|
||||||
|
|
||||||
|
/* close all descriptors */
|
||||||
|
maxfd = sysconf(_SC_OPEN_MAX);
|
||||||
|
for (fd = 0; fd < maxfd; ++fd) {
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
fd = open("/dev/null", O_RDWR);
|
fd = open("/dev/null", O_RDWR);
|
||||||
|
|
||||||
dup2(fd, STDIN_FILENO);
|
dup2(fd, STDIN_FILENO);
|
||||||
|
Reference in New Issue
Block a user