From ce7ae837b3d988d9617ed56edf169af0a21d47ec Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Wed, 3 Oct 2012 09:33:43 +0400 Subject: [PATCH] fixed compilation (dup result) --- ngx_rtmp_enotify_module.c | 12 +++--------- ngx_rtmp_exec_module.c | 12 +++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/ngx_rtmp_enotify_module.c b/ngx_rtmp_enotify_module.c index 0e7be8a..a81b8e2 100644 --- a/ngx_rtmp_enotify_module.c +++ b/ngx_rtmp_enotify_module.c @@ -260,15 +260,9 @@ ngx_rtmp_enotify_exec(ngx_rtmp_session_t *s, ngx_rtmp_enotify_conf_t *ec) /* child */ fd = open("/dev/null", O_RDWR); - if (fd != -1) { - close(0); - close(1); - close(2); - - dup(fd); - dup(fd); - dup(fd); - } + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); args = ngx_palloc(s->connection->pool, (ec->args.nelts + 2) * sizeof(char *)); diff --git a/ngx_rtmp_exec_module.c b/ngx_rtmp_exec_module.c index 02f7781..6e9a405 100644 --- a/ngx_rtmp_exec_module.c +++ b/ngx_rtmp_exec_module.c @@ -346,15 +346,9 @@ ngx_rtmp_exec_run(ngx_rtmp_session_t *s, size_t n) /* child */ fd = open("/dev/null", O_RDWR); - if (fd != -1) { - close(0); - close(1); - close(2); - - dup(fd); - dup(fd); - dup(fd); - } + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); args = ngx_palloc(s->connection->pool, (ec->args.nelts + 2) * sizeof(char *));