Looks good. I wonder how I tested the original code ;-)
I think my original intention was to do an lseek() - once - instead of
O_APPEND - but this lseek is missing. O_APPEND should work too, it's
somewhat of an overkill I guess, but should work. I'll commit this.


--
Nadav Har'El
[email protected]

On Mon, Mar 6, 2017 at 4:37 PM, Justin Cinkelj <[email protected]>
wrote:

> 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 <[email protected]>
> ---
>  loader.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/loader.cc b/loader.cc
> index 80a9c79..0398cd3 100644
> --- 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 {
> --
> 2.9.3
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to