Fix MinGW build as followup to recent Gnulib changes

Gnulib added AT_EMPTY_PATH support to its 'fstatat', but
the MinGW build must use its own 'fstatat' implementation.
These changes avoid compiling Gnulib's fstatat.c, and add
support for AT_EMPTY_PATH to the MinGW implementation.
* src/w32.c (fstatat): Support AT_EMPTY_PATH.

* nt/inc/unistd.h (AT_EMPTY_PATH): Define.
* nt/mingw-cfg.site (gl_cv_func_fstatat_null_file): Set to 'yes'
to avoid compiling Gnulib's fstatat.
This commit is contained in:
Eli Zaretskii 2026-07-18 09:25:21 +03:00
parent d71a399fdd
commit e3ec1cb8cc
3 changed files with 5 additions and 0 deletions

View file

@ -29,6 +29,7 @@ extern int faccessat (int, char const *, int, int);
#define AT_FDCWD (-3041965)
#define AT_EACCESS 4
#define AT_SYMLINK_NOFOLLOW 4096
#define AT_EMPTY_PATH 8192
#define O_IGNORE_CTTY 0
#define O_NOCTTY 0

View file

@ -106,6 +106,7 @@ ac_cv_func_lstat=yes
gl_cv_func_lstat_dereferences_slashed_symlink=yes
ac_cv_func_fstatat=yes
gl_cv_func_fstatat_zero_flag=yes
gl_cv_func_fstatat_null_file=yes
ac_cv_func_fchmodat=yes
gl_cv_func_fchmodat_works="not-needed-so-yes"
ac_cv_func_lchmod=yes

View file

@ -5791,6 +5791,9 @@ fstatat (int fd, char const *name, struct stat *st, int flags)
Gnulib does this and can serve as a model. */
char fullname[MAX_UTF8_PATH];
if (flags & AT_EMPTY_PATH && !name)
name = "";
if (fd != AT_FDCWD)
{
char lastc = dir_pathname[strlen (dir_pathname) - 1];