fdopendir: preserve argument fd before returning
* lib/fdopendir.c: Adjust comments to say POSIX, not Solaris.
(fdopendir_with_dup, fd_clone_opendir): New static functions.
(fdopendir): Use them, arranging for FD to be open to the same
directory that it was when it started. (It might be temporarily
closed while fdopendir is running, so this not thread- or
signal-safe.) Be careful to do the right thing even when file
descriptors are scarce and dup fails with errno == EMFILE. See
<http://lists.gnu.org/archive/html/bug-gnulib/2010-09/msg00208.html>.