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=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 7F67822064 for ; Thu, 18 Jan 2024 01:06:35 +0100 (CET) Received: (qmail 9300 invoked by uid 550); 18 Jan 2024 00:04:17 -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 9243 invoked from network); 18 Jan 2024 00:04:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtone.fr; s=google; t=1705536357; x=1706141157; darn=lists.openwall.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mlDKR4KVHUyX93cn43VUDEbt0RlYNO3mNGfmnwzIPdo=; b=RnX1gPugWb8cQBBQtT3u5JDJ8DB7fjv9kcNqXgOPW1SJCbuhKf8Ce2AuOYaP7eShF5 RnRhw3S2jleoHtMaSNb/X1mdWl6ls7pGnXEYrHmfPZYlQc/U+FZXUQAgKtNsXMXDkMEU iys0EWDiE/yl+iuHknusfvksDyUF9HeQ6cd+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705536357; x=1706141157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mlDKR4KVHUyX93cn43VUDEbt0RlYNO3mNGfmnwzIPdo=; b=UyYcbwG39hIrbLlJbx+ZU7smTj+hbojLj7DHRSVUSrud5D3GH4NHDB1XswpPuoyPnd G38ASxDzrIL4QMWiHWOlukOvTLYi57589XZHDtYtJQDkkOAAENLOaCpMa66TY7XinL4S +IaAIEvkOE9iP5r+Z6M6nhcRCcxV26cLMEBJOzA8F8EGLizqACXgpVx0Geqx0Z9bC3qH VqxDB3jGPo1JU6Yapb20IEOrPnRbZndcNazLEDDIjCtB/1cx2q4AYZE6FFT9BqAxxDiY 1fwOIRWZ5WXg8fAd7NHDdZuSUebFgG09nHJs5kzIAwueYy0SuA7OMldnttXQP7vLdjTY UR9w== X-Gm-Message-State: AOJu0YzaSeakVDMP12cG/itLTUX/Y63c7Yy9rgVN6GSs7LzsoNLobQOo LLUQQSHpLRoWbLst5nNPvz78Wm5cBvfpqkLQgwgLYRYRWvnHrXRGG45B0CUSljBnknKDlAwHasX q X-Google-Smtp-Source: AGHT+IFEhre4titQNkPqvB3Bgu8qQnGaQxCgze6cnVAsNqL4yYq0TnAc8rChrJ+5+IvgIz7BbVEBfQ== X-Received: by 2002:a05:600c:690f:b0:40e:6033:287a with SMTP id fo15-20020a05600c690f00b0040e6033287amr3324wmb.67.1705536357504; Wed, 17 Jan 2024 16:05:57 -0800 (PST) From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= To: musl@lists.openwall.com Cc: gael.portay@rtone.fr Date: Thu, 18 Jan 2024 01:05:40 +0100 Message-ID: <20240118000540.369070-4-gael.portay@rtone.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240118000540.369070-1-gael.portay@rtone.fr> References: <20240118000540.369070-1-gael.portay@rtone.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH 3/3] use new SYS_fchmodat2 syscall to implement fchmodat with flags 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.0