public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_4-branch] Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag
@ 2023-07-26 13:20 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-07-26 13:20 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a2e5f53217861d09c9fd9c692c6e38222eb6a32d

commit a2e5f53217861d09c9fd9c692c6e38222eb6a32d
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Jul 12 13:45:24 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Jul 26 15:19:59 2023 +0200

    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>

Diff:
---
 winsup/cygwin/syscalls.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index a8b8206af0fc..33cf4f07212c 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);
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-26 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 13:20 [newlib-cygwin/cygwin-3_4-branch] Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).