| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/dirent-private.h: On mingw, define 'struct gl_directory' as a
wrapper around the original DIR. On MSVC, add an 'fd_to_close' field to
'struct gl_directory'.
* lib/dirent.in.h (DIR): Define when DIR_HAS_FD_MEMBER is 0, i.e. on
both mingw and MSVC.
(GNULIB_defined_DIR): New macro.
(opendir): Avoid incompatible redeclaration.
(readdir): Consider REPLACE_READDIR.
(rewinddir): Consider REPLACE_REWINDDIR.
* m4/dirent_h.m4 (gl_DIRENT_DIR): New macro.
(gl_DIRENT_H): Invoke it.
(gl_DIRENT_H_DEFAULTS): Initialize REPLACE_READDIR, REPLACE_REWINDDIR.
* modules/dirent (Makefile.am): Substitute DIR_HAS_FD_MEMBER,
REPLACE_READDIR, REPLACE_REWINDDIR.
--
* lib/dirfd.c (dirfd): If GNULIB_defined_DIR, just use the
'fd_to_close' field.
* m4/dirfd.m4 (gl_FUNC_DIRFD): Set HAVE_DIRFD. Don't set REPLACE_DIRFD
to 1 if HAVE_DIRFD is 0. If DIR_HAS_FD_MEMBER is 0, ensure dirfd.c gets
compiled.
* modules/dirfd (Files): Add lib/dirent-private.h.
(Depends-on, configure.ac): Simplify conditions.
--
* lib/closedir.c: Include <stdlib.h> always, for free().
(closedir): If GNULIB_defined_DIR, arrange to call close(dirfd(dirp)) at
the end. On mingw, call free() of dirp. Prefer testing HAVE_DIRENT_H,
for consistency with dirent.h.
* m4/closedir.m4 (gl_FUNC_CLOSEDIR): Don't set REPLACE_CLOSEDIR to 1 if
HAVE_CLOSEDIR is 0. If DIR_HAS_FD_MEMBER is 0, ensure closedir.c gets
compiled.
--
* lib/opendir.c: Include <stdlib.h> always. Include <string.h>.
(opendir): On mingw, allocate the 'struct gl_directory' through malloc.
If GNULIB_defined_DIR, set the 'fd_to_close' field to -1. Prefer
testing HAVE_DIRENT_H, for consistency with dirent.h.
* m4/opendir.m4 (gl_FUNC_OPENDIR): Don't set REPLACE_OPENDIR to 1 if
HAVE_OPENDIR is 0. If DIR_HAS_FD_MEMBER is 0, ensure opendir.c gets
compiled.
--
* lib/fdopendir.c (fdopendir): If GNULIB_defined_DIR, use a simple
implementation based on opendir and the fchdir module. If __KLIBC__,
don't define unused auxiliary functions.
* modules/fdopendir (Files): Add lib/dirent-private.h.
--
* lib/readdir.c (readdir): On mingw, redirect to the original readdir
function. Prefer testing HAVE_DIRENT_H, for consistency with dirent.h.
* m4/readdir.m4 (gl_FUNC_READDIR): If DIR_HAS_FD_MEMBER is 0, ensure
readdir.c gets compiled.
* modules/readdir (configure.ac): Consider REPLACE_READDIR.
--
* lib/rewinddir.c (rewinddir): On mingw, redirect to the original
rewinddir function. Prefer testing HAVE_DIRENT_H, for consistency with
dirent.h.
* m4/rewinddir.m4 (gl_FUNC_REWINDDIR): If DIR_HAS_FD_MEMBER is 0, ensure
rewinddir.c gets compiled.
* modules/rewinddir (configure.ac): Consider REPLACE_REWINDDIR.
--
* lib/fchdir.c (dir_info_t): Remove a FIXME.
|
| |
|
|
|
|
|
|
|
|
|
| |
See: https://www.gnu.org/licenses/gpl-3.0.html#howto
Run:
$ git grep -l 'Foundation; either version 3' \
| xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/'
* All files using GPLv3: Adjust via the above command.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/closedir.c (closedir): Unregister fd if closedir() succeeds.
* lib/dirent.in.h (_gl_register_dirp_fd, _gl_unregister_dirp_fd):
Declare on kLIBC.
* lib/dirfd.c (struct dirp_fd_list): New. Structures to keep track of
fd associated with dirp.
(_gl_register_dirp_fd): New. Register fd associated with dirp to
dirp_fd_list.
(_gl_unregister_dirp_fd): New. Unregister fd with closing it.
(dirfd): Implemented for kLIBC.
* lib/fdopendir.c (fdopendir): Implemented for kLIBC.
* lib/opendir.c (opendir): New. Register fd and dirp pair if open()
succeeds.
* m4/closedir.m4 (gl_FUNC_CLOSEDIR): Replace if OS/2.
* m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise.
(REPLACE_DIRFD): Define to 1 if replaced.
* m4/opendir.m4 (gl_FUNC_OPENDIR): Likewise.
* modules/closedir (Depends-on): Add dirfd.
* modules/dirfd (Depends-on): Add 'test $REPLACE_DIRFD = 1' to errno
condition.
(configure.ac): Add dirfd to LIBOBJS if $REPLACE_DIRFD = 1 as well.
* modules/opendir (Depends-on): Add dirfd.
|
|
|
|
|
|
|
|
|
|
| |
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
|
| |
* lib/fdopendir.c (fd_clone_opendir) [REPLACE_FCHDIR]:
Use 'dup' if dirfd fails. Suggested by Eli Zaretskii in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-03/msg00033.html
* modules/fdopendir (Depends-on): Add dirfd.
|
|
|
|
| |
* lib/fdopendir.c (fdopendir_with_dup): REPLACE_FCHDIR was misspelled.
|
|
|
|
|
|
| |
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
| |
I ran 'make update-copyright'.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
| |
Run "make update-copyright". Compare to commit 1602f0a from last year.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
| |
Run "make update-copyright".
|
|
|
|
| |
Run the new "make update-copyright" rule.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/fdopendir.c (REPLACE_FCHDIR): #define to 0 if not defined.
(fdopendir_with_dup, fd_clone_opendir): Now have extra CWD arg.
All callers changed.
(fdopendir): Invoke save_cwd at the top level, not after using
multiple dup() calls to use up file descriptors. Then retry
fdopendir_with_dup. This avoids failure with EMFILE if FD is 1
less than the maximum number of open file descriptors, because
save_cwd fails with errno == EMFILE. Problem reported by tsteven4
on Mac OS X 10.6.4 for tar 1.24
<http://lists.gnu.org/archive/html/bug-tar/2010-10/msg00084.html>
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00000.html>
and for tar 1.25
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00038.html>.
|
|
|
|
|
| |
* lib/fdopendir.c (fd_clone_opendir): Move declaration for older
compilers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpenBSD 4.7 is one such system. The most noticeable effect was
failure of any application making nontrivial use of fts: rm, du,
chown, chmod etc. E.g., "mkdir -p a/b; ./rm -rf a" would fail with
./rm: traversal failed: `a': Bad file descriptor
Debugging that, you see that even though FD 6 was closed just
prior to the opendir call in fd_clone_opendir, its resulting
dir->dd_fd was 8, rather than the expected value of 6:
Breakpoint 3, fdopendir_with_dup (fd=6, older_dupfd=-1) at fdopendir.c:93
93 close (fd);
(gdb) n
94 dir = fd_clone_opendir (dupfd);
(gdb) n
95 saved_errno = errno;
(gdb) p dir->dd_fd
$11 = 8
Notice how it closes FD 6, then gets a DIR* pointer using FD 8.
The problem is that on OpenBSD, fd_clone_opendir has to resort
to using the old-style save/restore CWD mechanism, due to its
lack of openat/proc support, and *that* would steal the FD (6)
that opendir was supposed to use.
The fix is to squirrel away the desired FD so that save_cwd uses a
different one, and then free the dest FD right before calling opendir.
That guarantees opendir will use the required file descriptor.
* lib/fdopendir.c (fd_clone_opendir): Handle the above.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>.
|
|
|
|
|
| |
Use the same procedure as for 2009, outlined in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fdopendir(open("file",O_RDONLY)) mistakenly succeeded, with
subsequent readdir() failing with ENOTDIR.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Check for Hurd bug in
allowing non-directory fds.
* lib/fdopendir.c (rpl_fdopendir): Work around it.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): New witness.
* modules/dirent (Makefile.am): Substitute it.
* lib/dirent.in.h (fdopendir): Declare replacement.
* doc/posix-functions/fdopendir.texi (fdopendir): Document this.
* tests/test-fdopendir.c (main): Test something other than
/dev/null, since on Hurd that behaves like a directory.
Signed-off-by: Eric Blake <ebb9@byu.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* modules/dirent-safer: New file.
* lib/dirent--.h: Likewise.
* lib/dirent-safer.h: Likewise.
* lib/opendir-safer.c: Likewise.
* m4/dirent-safer.m4: Likewise.
* MODULES.html.sh (Enhancements for POSIX:2008): Mention it.
* modules/dirent-safer-tests: New test.
* tests/test-dirent-safer.c: New file.
* lib/fdopendir.c (includes): Ensure fdopendir is also safe.
Signed-off-by: Eric Blake <ebb9@byu.net>
|
|
|
|
|
|
|
|
|
|
| |
* lib/unistd.in.h (_gl_directory_name): New prototype.
* lib/fchdir.c (_gl_directory_name): Implement it.
(fchdir): Use it to simplify implementation.
* lib/fdopendir.c (fdopendir) [REPLACE_FCHDIR]: Use metadata from
fchdir, when available, to avoid calling [f]chdir().
Signed-off-by: Eric Blake <ebb9@byu.net>
|
|
* lib/openat.c (fdopendir): Move...
* lib/fdopendir.c: ...into new file.
* modules/fdopendir: New module.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): New file.
* modules/openat (Depends-on): Add fdopendir.
* m4/openat.m4 (gl_FUNC_OPENAT): No longer need to check for
fdopendir here.
* modules/savedir (Depends-on): Only need fdopendir, not full
openat.
* lib/savedir.c (include): Use <dirent.h>, not "openat.h".
* lib/openat.h (fdopendir): Drop prototype.
* lib/dirent.in.h (fdopendir): Provide prototype.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): Add replacements.
* modules/dirent (Makefile.am): Substitute them.
* MODULES.html.sh (File system functions): Mention it.
* doc/posix-functions/fdopendir.texi (fdopendir): Likewise.
* modules/fdopendir-tests: New file.
* tests/test-fdopendir.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
|