backupfile: new dir_fd args
commit1b01fe40918401a965651499b0ba37ff53be86a9
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Oct 2018 02:10:21 +0000 (23 19:10 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Oct 2018 02:11:12 +0000 (23 19:11 -0700)
tree7bff60c2b8856e06669fbe0580cf2ce506a45ca4
parent0f0ee4a910a71e7d53d6e05b2bc8bc45afff96ac
backupfile: new dir_fd args

New module opendirat with code taken from fts.
Use this module to let backupfile use a directory file descriptor.
* NEWS: Document the incompatible change.
* lib/backup-find.c (find_backup_file_name):
* lib/backup-rename.c (backup_file_rename):
New arg DIR_FD.
* lib/backupfile.c: Include stdint.h, for SIZE_MAX.
(SIZE_MAX): Remove.
Include opendirat.h rather than dirent--.h.
(check_extension): New args DIR_FD and BASE_MAX.  All callers changed.
(numbered_backup): New args DIR_FD and PNEW_FD.  All callers changed.
(backupfile_internal): New arg DIR_FD.  All callers changed.
* lib/fts.c: Include opendirat.h.
(opendirat): Move to opendirat.c.
* lib/opendirat.c, lib/opendirat.h, modules/opendirat: New files.
* modules/backupfile (Depends-on): Remove dirfd, opendir.
Add opendirat.
* modules/fts (Depends-on): Remove fdopendir, openat-safer.
Add opendirat.
13 files changed:
ChangeLog
NEWS
lib/backup-find.c
lib/backup-internal.h
lib/backup-rename.c
lib/backupfile.c
lib/backupfile.h
lib/fts.c
lib/opendirat.c [new file with mode: 0644]
lib/opendirat.h [new file with mode: 0644]
modules/backupfile
modules/fts
modules/opendirat [new file with mode: 0644]