[CRIU] [PATCH] log: Open logc files with O_TRUNC

Cyrill Gorcunov gorcunov at openvz.org
Fri May 25 07:43:02 EDT 2012


It's really confusing when one use -o option
and didn't see update on top of log file.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 log.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/log.c b/log.c
index cd1ed53..2369033 100644
--- a/log.c
+++ b/log.c
@@ -42,7 +42,7 @@ int log_init(const char *output)
 	}
 
 	if (output) {
-		new_logfd = open(output, O_CREAT | O_WRONLY | O_APPEND, 0600);
+		new_logfd = open(output, O_CREAT | O_TRUNC | O_WRONLY | O_APPEND, 0600);
 		if (new_logfd < 0) {
 			pr_perror("Can't create log file %s", output);
 			return -1;
-- 
1.7.7.6



More information about the CRIU mailing list