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, 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 EA01124B3F for ; Sun, 18 Feb 2024 03:28:34 +0100 (CET) Received: (qmail 32037 invoked by uid 550); 18 Feb 2024 02:24:08 -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 31783 invoked from network); 18 Feb 2024 02:24:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtone.fr; s=google; t=1708223225; x=1708828025; 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=S8ISvjlwgnvY6IZBzMqJKmaS41Du065pTBW3DTEpClM=; b=KNGQxxscaEa8ZgL2D5ESOSLuxWU/kf4UZ48tcnc5QZTCJQO48CoCTk2wmxwVLrPCSr gi9OExBlefViKFJ+Pzh8p2pseeYGeZbgEQ/Led15JnuhvmpPZY9zxYdpWFJILexPUdw7 2zQukkP8XxwTmZZO7E6VR2yUWIASty9ttVyEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708223225; x=1708828025; 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=S8ISvjlwgnvY6IZBzMqJKmaS41Du065pTBW3DTEpClM=; b=bPjsih8OseHkjWSA6ienf2KwQ1lvO+4fAqF92ZKlmT5Jdt7JY57cfQUgLjQPAZU367 ypirHp1L6QYHIQe3xrEoDbTv/aox44iCuV6/JidVO6WswGI0FbfqZU+v7ETLVY3U5Fu8 CEGgYOcgW51BBM392zuult6WZAdXjThkM0JlDtdKzs4mSJebd1SSEffj8rNqmyoVEMpH MgzOcc4L6AJ8/+hRtFfNVTOZawEg/NMtXukY50uob4z+HesF4g9HZTj/sO+i+WaAUFXI IswHAUgMa79YdwsMS8VTtl8U5Ns7Q5r1wEMotM3IYIr6tNRheuPGnryxXl9+ukEff5bX Hm5g== X-Gm-Message-State: AOJu0Yz1JhAEC/ZAnEYvTaIMxVQN/9OLmnkhCjfjPzqpgDL6QOzeDArk NVxlahcXD2vorCHI/a+13S9ATE7Tkfj5lCdDuXbManTAY0fblgSG4ct4JiPmDFCIsrbuSW5R43g x X-Google-Smtp-Source: AGHT+IEbJmNatCVQhyhbqV3h5Iu/Bgcfx4LxR1UHcljWUbM3pGJ1SFAeFoCBk20d3tJp5xhHiUIaaA== X-Received: by 2002:a5d:63c2:0:b0:33d:1b69:fbbe with SMTP id c2-20020a5d63c2000000b0033d1b69fbbemr3619878wrw.29.1708223225650; Sat, 17 Feb 2024 18:27:05 -0800 (PST) From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= To: musl@lists.openwall.com Cc: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Sun, 18 Feb 2024 03:26:50 +0100 Message-ID: <20240218022650.1097269-9-gael.portay@rtone.fr> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240218022650.1097269-1-gael.portay@rtone.fr> References: <20240218022650.1097269-1-gael.portay@rtone.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH v2 8/8] 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.2