-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 11/5/2009 10:43 AM:
> $ cat foo.c
> #include <stdio.h>
> int main()
> {
>   if (stderr != freopen("/dev/null","w",stderr))
>     return 5;
>   return fileno(stderr);
> }
> $ ./foo && echo $?
> 2
> $ ./foo <&- && echo $?
> 0
> $ ./foo >&- && echo $?
> 1

I typed this too fast.  To see the real answer:

$ ./foo; echo $?
2
$ ./foo <&-; echo $?
0
$ ./foo >&-; echo $?
1

- --
Don't work too hard, make some time for fun as well!

Eric Blake             e...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrzhnYACgkQ84KuGfSFAYD5qgCgmzIwCITOT4an9/YCpwdBtRn3
ZAoAn22OK8jIUQdbODRKA/Sny3NeK4X/
=WRpE
-----END PGP SIGNATURE-----


Reply via email to