From: Justin Cinkelj <justin.cink...@xlab.si>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

loader: fix log redirection append option

The O_APPEND flag was missing when "--redirect=>>my.log ..." was used.
Thus new output started to overwrite old content.

Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
Message-Id: <20170306143706.10745-1-justin.cink...@xlab.si>

---
diff --git a/loader.cc b/loader.cc
--- a/loader.cc
+++ b/loader.cc
@@ -447,7 +447,7 @@ void* do_main_thread(void *_main_args)
         bool append = (opt_redirect.substr(0, 2) == ">>");
         auto fn = opt_redirect.substr(append ? 2 : 0);
         int fd = open(fn.c_str(),
-                O_WRONLY | O_CREAT | (append ? 0 : O_TRUNC), 777);
+                O_WRONLY | O_CREAT | (append ? O_APPEND: O_TRUNC), 777);
         if (fd < 0) {
             perror("output redirection failed");
         } else {

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to