-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 8/18/2007 10:34 AM: > According to Paul Eggert on 8/17/2007 5:43 PM: >> Eric Blake-1 <[EMAIL PROTECTED]> writes: > >>> is it reasonable to have yesno install an atexit >>> handler on first invocation? If the handler is not present, >>> then stdin was never used (at least not by yesno). >> Yes, that sounds reasonable to me. > > How about the following patch? Tested on Linux, including that test-yesno > detected failure prior to the yesno.c patch.
Note that in testing this patch, I found another category of problems that it serendipitously fixes (as in, read errors should always cause a non-zero exit, but closed stdin is only an issue if it was read from): pre-patch: $ touch foo $ rm -i foo <&-; echo $? rm: remove regular empty file `foo'? 0 $ ls foo foo post-patch: $ touch foo $ rm -i foo <&-; echo $? rm: remove regular empty file `foo'? rm: error closing file: Bad file descriptor 1 $ ls foo foo $ rm foo <&-; echo $? 0 - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGxzij84KuGfSFAYARAsO8AKDGpqGx4+/XXlAbKF7K9yXHbV7KzgCdHSnD h2r2pauITvHuA86e/mQiCiI= =15VS -----END PGP SIGNATURE-----
