]> diplodocus.org Git - nmh/commit
mhlsbr.c: Don't read(2) from fileno(3) of stdout.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 16 Sep 2017 21:58:11 +0000 (22:58 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 17 Sep 2017 12:47:46 +0000 (13:47 +0100)
commit6fd323cc02e4e90d24e30b8c78a88a55e749556f
tree7729b7a303eeb7a62af1b77a14560f02da680a0a
parent4d0110006d4e72f82fb597f170c7d9991f2ca0bf
mhlsbr.c: Don't read(2) from fileno(3) of stdout.

Remove the assumption that file descriptor 1 is readable.  It can be if
it, or where it was dup(2)'d from, was opened read/write, e.g. on
/dev/tty.  But it can easily be arranged with shell re-direction that it
isn't, and then the read(2) fails.  Pass 0, standard input's file
descriptor, instead.  Don't use fileno(stdin) as I can't think of a need
to support that being non-zero, but its use makes the reader think it
might.  Bug pre-dates git.
uip/mhlsbr.c