diff --git a/ngx_rtmp_enotify_module.c b/ngx_rtmp_enotify_module.c index f6c3858..4acea5f 100644 --- a/ngx_rtmp_enotify_module.c +++ b/ngx_rtmp_enotify_module.c @@ -243,7 +243,7 @@ static ngx_int_t ngx_rtmp_enotify_exec(ngx_rtmp_session_t *s, ngx_rtmp_enotify_conf_t *ec) { #if !(NGX_WIN32) - int pid, fd; + int pid, fd, maxfd; ngx_str_t a, *arg; char **args; 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: /* child */ + + /* close all descriptors */ + maxfd = sysconf(_SC_OPEN_MAX); + for (fd = 0; fd < maxfd; ++fd) { + close(fd); + } + fd = open("/dev/null", O_RDWR); dup2(fd, STDIN_FILENO);