From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 13093392B149; Wed, 7 Dec 2022 19:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13093392B149 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670440484; bh=5qVz1qtyHB36ylHGevrHRL2tqCcILSh0kbQdHah6sxQ=; h=From:To:Subject:Date:From; b=JSopgjhJZ8Cy1es5mElv9KftStnM1r/cfWQZN0habwXX4bJfmpkJlJ/cmxfQWsVdK 508kX0/Kfe7xS/za9RHwZA8KE2pCL+g5eKOoPuSHtWAcQvQQYKtyflmHz5r2RM1NRy k32ZSlmjRk1nLnyq8/ZJxoSHOo3hS4Iojdp5ayPY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] Linux: consolidate chmod implementation X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella Netto X-Git-Refname: refs/heads/master X-Git-Oldrev: b14e1f9fcd3ca4dd86d0637f6e32e7bf642394da X-Git-Newrev: f0fa84d31fac30ce0f5cba715751478253f4ba8c Message-Id: <20221207191444.13093392B149@sourceware.org> Date: Wed, 7 Dec 2022 19:14:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f0fa84d31fac30ce0f5cba715751478253f4ba8c commit f0fa84d31fac30ce0f5cba715751478253f4ba8c Author: Adhemerval Zanella Netto Date: Wed Oct 19 19:14:06 2022 -0300 Linux: consolidate chmod implementation Use chmod syscall if defined, otherwise use fchmodat. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell Diff: --- sysdeps/unix/sysv/linux/{generic => }/chmod.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sysdeps/unix/sysv/linux/generic/chmod.c b/sysdeps/unix/sysv/linux/chmod.c similarity index 78% rename from sysdeps/unix/sysv/linux/generic/chmod.c rename to sysdeps/unix/sysv/linux/chmod.c index 98b72c0be1..aedd4c0aed 100644 --- a/sysdeps/unix/sysv/linux/generic/chmod.c +++ b/sysdeps/unix/sysv/linux/chmod.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2011-2022 Free Software Foundation, Inc. +/* Change permissions of a file. Linux version. + Copyright (C) 2011-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,14 +17,17 @@ . */ #include -#include #include /* Change the protections of FILE to MODE. */ int __chmod (const char *file, mode_t mode) { - return INLINE_SYSCALL (fchmodat, 3, AT_FDCWD, file, mode); +#ifdef __NR_chmod + return INLINE_SYSCALL_CALL (chmod, file, mode); +#else + return INLINE_SYSCALL_CALL (fchmodat, AT_FDCWD, file, mode); +#endif } libc_hidden_def (__chmod)