From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id D07AD385AFAF; Wed, 26 Jul 2023 13:18:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D07AD385AFAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690377531; bh=OIkvLe3ui1q77UC6BaREPjeqRiOCgaGZxaZ5+cksgxI=; h=From:To:Subject:Date:From; b=Q0OY7GaR8Zce1jyuA0wp4MJbsoVT5I2MxLoGNPoC1ymC42Lq7yt/x69y2O0iUSKJM bGw5qdD10LOq1fjXZgImUxJA8J40RnSdCiIqGGJ6gCogP2lCbfOj2FyoMWg7vkwa5M sQPJ/scvQ8jXIXU58JhHEHTMFDKSpgV0+Aal47Ww= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: a891dc7605b565282a1274198c9e4a033cafc348 X-Git-Newrev: 00510919993da49cf91421fe13242a7d8a82c1fd Message-Id: <20230726131851.D07AD385AFAF@sourceware.org> Date: Wed, 26 Jul 2023 13:18:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D00510919993= da49cf91421fe13242a7d8a82c1fd commit 00510919993da49cf91421fe13242a7d8a82c1fd Author: Corinna Vinschen AuthorDate: Wed Jul 12 13:45:24 2023 +0200 Commit: Corinna Vinschen CommitDate: Wed Jul 26 15:14:27 2023 +0200 Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag =20 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. =20 Reviewed-by: Johannes Schindelin Signed-off-by: Corinna Vinschen 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 8d3ec46f3a3c..9c7ad61febac 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -4416,11 +4416,10 @@ pclose (FILE *fp) =20 static int gen_full_path_at (char *path_ret, int dirfd, const char *pathname, - bool null_pathname_allowed =3D false) + int flags =3D 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; @@ -4678,7 +4677,7 @@ futimesat (int dirfd, const char *pathname, const str= uct timeval times[2]) __try { char *path =3D tp.c_get (); - if (gen_full_path_at (path, dirfd, pathname, true)) + if (gen_full_path_at (path, dirfd, pathname, _AT_NULL_PATHNAME_ALLOW= ED)) __leave; return utimes (path, times); }