Re: Why dup()?

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



I did have a better example.

I do have a better example.

  ssh localhost 'exec cat > /dev/null 2>&1' | { read l; echo ${l:-EOF}; }

(Bonus points for seeing the irony.)

This should immediately print EOF.  It doesn't, because the duplicate file descriptor on stdout prevents pipe closure until ssh exits.

Simply removing dup(), that is, saying "out = STDOUT_FILENO", results in correct behavior.  I think it's the right change.  I'll go further and suggest that the same change should be made to err.  I would suggest it should also be made to in, but that breaks tcsetattr on exit.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux