Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
chmod.2: document EFTYPE
To:
OpenBSD tech <tech@openbsd.org>
Date:
Fri, 2 May 2025 20:50:39 +0000

Download raw body.

Thread
Now it reads as if 'chmod +t file' wouldn't fail at all, but that's true only for root.
sticky(8) correctly documents this, so bring chmod(2) up to speed.

This is sys/ufs/ufs/ufs_vnops.c ufs_chmod() since import:

465	if (cred->cr_uid && !vnoperm(vp)) {
466		if (vp->v_type != VDIR && (mode & S_ISTXT))
467			return (EFTYPE);

Feedback? OK?

Index: lib/libc/sys/chmod.2
===================================================================
RCS file: /cvs/src/lib/libc/sys/chmod.2,v
diff -u -p -r1.28 chmod.2
--- lib/libc/sys/chmod.2	10 Sep 2015 17:55:21 -0000	1.28
+++ lib/libc/sys/chmod.2	2 May 2025 20:45:15 -0000
@@ -88,7 +88,7 @@ If mode
 .Dv ISVTX
 (the
 .Em sticky bit )
-is set on a file, it is ignored.
+is set on a file by the superuser, it is ignored.
 .Pp
 If mode
 .Dv ISVTX
@@ -188,6 +188,9 @@ The named file resides on a read-only fi
 points outside the process's allocated address space.
 .It Bq Er EIO
 An I/O error occurred while reading from or writing to the file system.
+.It Bq Er EFTYPE
+An unprivileged user attempted to set a file's mode to
+.Dv ISVTX .
 .El
 .Pp
 Additionally, the