Bug 18450

Summary: issetugid() does not follow syscall conventions
Product: Base System Reporter: Valentin Nechayev <netch>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Valentin Nechayev 2000-05-08 15:20:00 UTC
When process is "tainted" (see issetugid(2)), issetugid() returns -1
and sets errno to 1 instead of returning 1 without error.

How-To-Repeat: 
netch@nn:~/tmp>cat 9.c
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main() {
   int rc, se;
   errno = 0;
   rc = issetugid();
   se = errno;
   printf( "%d; (%d) %s\n", rc, se, strerror( se ) );
   return 1;
}
netch@nn:~/tmp>gcc -o 9 9.c
netch@nn:~/tmp>ls -l 9
-rwxr-xr-x  1 netch  wheel  7763 May  8 17:01 9
netch@nn:~/tmp>./9
0; (0) Undefined error: 0

netch@nn:~/tmp>ls -l 9
-rwsr-xr-x  1 root  wheel  7763 May  8 17:01 9
netch@nn:~/tmp>./9
-1; (1) Operation not permitted
Comment 1 ps freebsd_committer freebsd_triage 2000-12-09 02:45:32 UTC
State Changed
From-To: open->closed

Committed!