[CRIU] [crtools-bot for Pavel Emelyanov ] log: Fix logfd screwup

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 2 06:54:42 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit ba64f87bfa1ef60034a45047473a71f6ebf445ed
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Fri Mar 2 15:44:13 2012 +0400

    log: Fix logfd screwup
    
    Broken by 7aa8e4b6 -- log was not moved to higher fd values.
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 log.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/log.c b/log.c
index 59908f5..9dde9bb 100644
--- a/log.c
+++ b/log.c
@@ -48,8 +48,6 @@ int log_init(const char *output)
 	 * requested.
 	 */
 
-	new_logfd = rlimit.rlim_cur - 1;
-
 	if (output) {
 		new_logfd = open(output, O_CREAT | O_WRONLY);
 		if (new_logfd < 0) {
@@ -57,11 +55,12 @@ int log_init(const char *output)
 			return -1;
 		}
 		current_logfd = new_logfd;
-	} else {
-		if (reopen_fd_as(new_logfd, current_logfd) < 0)
-			goto err;
-		current_logfd = new_logfd;
-	}
+	} else
+		new_logfd = DEFAULT_LOGFD;
+
+	current_logfd = rlimit.rlim_cur - 1;
+	if (reopen_fd_as(current_logfd, new_logfd) < 0)
+		goto err;
 
 	return 0;
 


More information about the CRIU mailing list