public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Linux: consolidate chmod implementation
@ 2022-12-07 19:14 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-12-07 19:14 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f0fa84d31fac30ce0f5cba715751478253f4ba8c

commit f0fa84d31fac30ce0f5cba715751478253f4ba8c
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
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 <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

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 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sysdep.h>
 
 /* 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07 19:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 19:14 [glibc] Linux: consolidate chmod implementation Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).