setfsuid.2: Clarify description of return value

More clearly describe the weirdness in the return value of this
system call, and ote the problems it creates in in BUGS

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2013-08-08 15:42:28 +02:00
parent fd524ab98b
commit 06e4308972
1 changed files with 13 additions and 8 deletions

View File

@ -28,7 +28,7 @@
.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added notes on capability requirements
.\"
.TH SETFSUID 2 2010-11-22 "Linux" "Linux Programmer's Manual"
.TH SETFSUID 2 2013-08-08 "Linux" "Linux Programmer's Manual"
.SH NAME
setfsuid \- set user identity used for filesystem checks
.SH SYNOPSIS
@ -67,12 +67,8 @@ matches either the real user ID, effective user ID, saved set-user-ID, or
the current value of
.IR fsuid .
.SH RETURN VALUE
On success, the previous value of
.I fsuid
is returned.
On error, the current value of
.I fsuid
is returned.
On both success and failure,
this call returns the previous filesystem user ID of the caller.
.SH VERSIONS
This system call is present in Linux since version 1.2.
.\" This system call is present since Linux 1.1.44
@ -102,7 +98,16 @@ The glibc
.BR setfsuid ()
wrapper function transparently deals with the variation across kernel versions.
.SH BUGS
No error messages of any kind are returned to the caller.
No error indications of any kind are returned to the caller,
and the fact that both successful and unsuccessful calls return
the same value makes it impossible to directly determine
whether the call succeeded or failed.
Instead, the caller must resort to looking at the return value
from a further call such as
.IR setfsuid(\-1)
(which will always fail), in order to determine if a preceding call to
.BR setfsuid ()
changed the filesystem user ID.
At the very
least,
.B EPERM