All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: [patch] chmod.2, lchmod.3: Document lchmod()
Date: Sun, 10 Jan 2021 05:37:13 +0100	[thread overview]
Message-ID: <39277473.ZaUlkdM7pu@omega> (raw)

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Hi,

lchmod (= the effect of fchmod with flag AT_SYMLINK_NOFOLLOW)
is implemented since glibc 2.32, see
https://sourceware.org/bugzilla/show_bug.cgi?id=14578
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=752dd17443e55a4535cb9e6baa4e550ede383540

Here is a patch to update the man pages accordingly.



[-- Attachment #2: 0001-chmod.2-lchmod.3-Document-lchmod.patch --]
[-- Type: text/x-patch, Size: 2341 bytes --]

From 22cbd89a89bc26a518537739d677a5736727738f Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 10 Jan 2021 05:20:30 +0100
Subject: [PATCH] chmod.2, lchmod.3: Document lchmod().

---
 man2/chmod.2  | 25 +++++++++++++++++++++----
 man3/lchmod.3 |  1 +
 2 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 man3/lchmod.3

diff --git a/man2/chmod.2 b/man2/chmod.2
index a54aec7..897dd87 100644
--- a/man2/chmod.2
+++ b/man2/chmod.2
@@ -29,15 +29,16 @@
 .\"   <michael@cantor.informatik.rwth-aachen.de>: NFS details
 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
-.TH CHMOD 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH CHMOD 2 2021-01-10 "Linux" "Linux Programmer's Manual"
 .SH NAME
-chmod, fchmod, fchmodat \- change permissions of a file
+chmod, fchmod, lchmod, fchmodat \- change permissions of a file
 .SH SYNOPSIS
 .nf
 .B #include <sys/stat.h>
 .PP
 .BI "int chmod(const char *" pathname ", mode_t " mode );
 .BI "int fchmod(int " fd ", mode_t " mode );
+.BI "int lchmod(const char *" pathname ", mode_t " mode );
 .PP
 .BR "#include <fcntl.h>" "           /* Definition of AT_* constants */"
 .B #include <sys/stat.h>
@@ -68,6 +69,12 @@ Feature Test Macro Requirements for glibc (see
 .\"        || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
 .fi
 .PP
+.BR lchmod ():
+.nf
+    Since glibc 2.32:
+        _DEFAULT_SOURCE
+.fi
+.PP
 .BR fchmodat ():
 .nf
     Since glibc 2.10:
@@ -93,6 +100,11 @@ which is dereferenced if it is a symbolic link.
 .BR fchmod ()
 changes the mode of the file referred to by the open file descriptor
 .IR fd .
+.IP *
+.BR lchmod ()
+is like
+.BR chmod (),
+but does not dereference symbolic links.
 .PP
 The new file mode is specified in
 .IR mode ,
@@ -220,8 +232,13 @@ can either be 0, or include the following flag:
 If
 .I pathname
 is a symbolic link, do not dereference it:
-instead operate on the link itself.
-This flag is not currently implemented.
+instead operate on the link itself, like
+.BR lchmod ().
+(By default,
+.BR fchmodat ()
+dereferences symbolic links, like
+.BR chmod ().)
+This flag is implemented since glibc 2.32.
 .PP
 See
 .BR openat (2)
diff --git a/man3/lchmod.3 b/man3/lchmod.3
new file mode 100644
index 0000000..92647d2
--- /dev/null
+++ b/man3/lchmod.3
@@ -0,0 +1 @@
+.so man2/chmod.2
-- 
2.7.4


             reply	other threads:[~2021-01-10  4:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10  4:37 Bruno Haible [this message]
2021-01-10  7:41 ` [patch] chmod.2, lchmod.3: Document lchmod() Dmitry V. Levin
2021-01-10 10:05   ` Bruno Haible
2021-01-10 17:50     ` Dmitry V. Levin
2021-01-11  8:02     ` Michael Kerrisk (man-pages)
2021-01-18 16:00       ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39277473.ZaUlkdM7pu@omega \
    --to=bruno@clisp.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.