Commit ba64f87b authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

log: Fix logfd screwup

Broken by 7aa8e4b6 -- log was not moved to higher fd values.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 119cee0d
...@@ -48,8 +48,6 @@ int log_init(const char *output) ...@@ -48,8 +48,6 @@ int log_init(const char *output)
* requested. * requested.
*/ */
new_logfd = rlimit.rlim_cur - 1;
if (output) { if (output) {
new_logfd = open(output, O_CREAT | O_WRONLY); new_logfd = open(output, O_CREAT | O_WRONLY);
if (new_logfd < 0) { if (new_logfd < 0) {
...@@ -57,11 +55,12 @@ int log_init(const char *output) ...@@ -57,11 +55,12 @@ int log_init(const char *output)
return -1; return -1;
} }
current_logfd = new_logfd; current_logfd = new_logfd;
} else { } else
if (reopen_fd_as(new_logfd, current_logfd) < 0) new_logfd = DEFAULT_LOGFD;
goto err;
current_logfd = new_logfd; current_logfd = rlimit.rlim_cur - 1;
} if (reopen_fd_as(current_logfd, new_logfd) < 0)
goto err;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment