Yay!

>From someone whom has tried 2>&- >&- on a dd run to be surprised to find the 
>status information go into the destination output file...

Thank you!


> On Dec 12, 2016, at 10:56 AM, Bartek Rutkowski <ro...@freebsd.org> wrote:
> 
> Author: robak (ports committer)
> Date: Mon Dec 12 18:56:40 2016
> New Revision: 309921
> URL: https://svnweb.freebsd.org/changeset/base/309921
> 
> Log:
>  Fix regression when stdin/out/err fds are are overridden by shell.
> 
>  Submitted by:        Pawel Biernacki <pawel.bierna...@gmail.com>
>  Reported by: ngie
>  Approved by: ngie
>  Sponsored by:        Mysterious Code Ltd.
>  Differential Revision:       https://reviews.freebsd.org/D8543
> 
> Modified:
>  head/bin/dd/dd.c
> 
> Modified: head/bin/dd/dd.c
> ==============================================================================
> --- head/bin/dd/dd.c  Mon Dec 12 18:55:41 2016        (r309920)
> +++ head/bin/dd/dd.c  Mon Dec 12 18:56:40 2016        (r309921)
> @@ -142,8 +142,6 @@ setup(void)
>               in.fd = open(in.name, O_RDONLY, 0);
>               if (in.fd == -1)
>                       err(1, "%s", in.name);
> -             if (caph_limit_stdin() == -1)
> -                     err(1, "unable to limit capability rights");
>       }
> 
>       getfdtype(&in);
> @@ -176,8 +174,6 @@ setup(void)
>               }
>               if (out.fd == -1)
>                       err(1, "%s", out.name);
> -             if (caph_limit_stdout() == -1)
> -                     err(1, "unable to limit capability rights");
>       }
> 
>       getfdtype(&out);
> @@ -188,6 +184,16 @@ setup(void)
>           errno != ENOSYS)
>               err(1, "unable to limit capability rights");
> 
> +     if (in.fd != STDIN_FILENO && out.fd != STDIN_FILENO) {
> +             if (caph_limit_stdin() == -1)
> +                     err(1, "unable to limit capability rights");
> +     }
> +
> +     if (in.fd != STDOUT_FILENO && out.fd != STDOUT_FILENO) {
> +             if (caph_limit_stdout() == -1)
> +                     err(1, "unable to limit capability rights");
> +     }
> +
>       if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) {
>               if (caph_limit_stderr() == -1)
>                       err(1, "unable to limit capability rights");
> 

_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to