diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2023-07-12 13:45:24 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-07-26 15:19:59 +0200 |
commit | a2e5f53217861d09c9fd9c692c6e38222eb6a32d (patch) | |
tree | 17d0362ca74dab0c76cf7c40919f2ecc2705ab98 | |
parent | 38b8c322d4798cec04c56f79112b84a465a15d27 (diff) | |
download | newlib-a2e5f53217861d09c9fd9c692c6e38222eb6a32d.zip newlib-a2e5f53217861d09c9fd9c692c6e38222eb6a32d.tar.gz newlib-a2e5f53217861d09c9fd9c692c6e38222eb6a32d.tar.bz2 |
Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag
Convert gen_full_path_at to take flag values from the caller, rather
than just a bool indicating that empty paths are allowed. This is in
preparation of a better AT_EMPTY_PATH handling in a followup patch.
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/syscalls.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a8b8206..33cf4f0 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -4414,11 +4414,10 @@ pclose (FILE *fp) static int gen_full_path_at (char *path_ret, int dirfd, const char *pathname, - bool null_pathname_allowed = false) + int flags = 0) { - /* Set null_pathname_allowed to true to allow GLIBC compatible behaviour - for NULL pathname. Only used by futimesat. */ - if (!pathname && !null_pathname_allowed) + /* futimesat allows a NULL pathname. */ + if (!pathname && !(flags & _AT_NULL_PATHNAME_ALLOWED)) { set_errno (EFAULT); return -1; @@ -4676,7 +4675,7 @@ futimesat (int dirfd, const char *pathname, const struct timeval times[2]) __try { char *path = tp.c_get (); - if (gen_full_path_at (path, dirfd, pathname, true)) + if (gen_full_path_at (path, dirfd, pathname, _AT_NULL_PATHNAME_ALLOWED)) __leave; return utimes (path, times); } |