From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 01FD6247FA for ; Fri, 23 Feb 2024 01:36:29 +0100 (CET) Received: (qmail 9761 invoked by uid 550); 23 Feb 2024 00:33:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 9723 invoked from network); 23 Feb 2024 00:33:04 -0000 Date: Thu, 22 Feb 2024 19:36:34 -0500 From: Rich Felker To: =?utf-8?B?R2HDq2w=?= PORTAY Cc: musl@lists.openwall.com Message-ID: <20240223003633.GY4163@brightrain.aerifal.cx> References: <20240218022650.1097269-1-gael.portay@rtone.fr> <20240218022650.1097269-9-gael.portay@rtone.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240218022650.1097269-9-gael.portay@rtone.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH v2 8/8] use new SYS_fchmodat2 syscall to implement fchmodat with flags On Sun, Feb 18, 2024 at 03:26:50AM +0100, Gaƫl PORTAY wrote: > commit 0dc4824479e357a3e23a02d35527e23fca920343 worked around for lack > of flags argument in syscall for fchmodat. > > linux 6.6 introduced a new syscall, SYS_fchmodat2, fixing this > deficiency. use it if any flags are passed, and fallback to the old > strategy on ENOSYS. continue using the old syscall when there are no > flags. this is the exact same strategy used when SYS_faccessat2 was used > to implement faccessat with flags. > --- > src/stat/fchmodat.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c > index 41db0c46..a3f407e3 100644 > --- a/src/stat/fchmodat.c > +++ b/src/stat/fchmodat.c > @@ -5,6 +5,11 @@ > > int fchmodat(int fd, const char *path, mode_t mode, int flag) > { > + if (flag) { > + int ret = __syscall(SYS_fchmodat2, fd, path, mode, flag); > + if (ret != -ENOSYS) return __syscall_ret(ret); > + } > + > if (!flag) return syscall(SYS_fchmodat, fd, path, mode); > > if (flag != AT_SYMLINK_NOFOLLOW) > -- > 2.43.2 I've reordered this to avoid confusing repeating conditionals, so it's now: if (!flag) return syscall(SYS_fchmodat, fd, path, mode); + int ret = __syscall(SYS_fchmodat2, fd, path, mode, flag); + if (ret != -ENOSYS) return __syscall_ret(ret); ... (with the later declaration of ret removed). Thanks for getting these patches in to make it into the release! Rich