| Summary: | issetugid() does not follow syscall conventions | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Valentin Nechayev <netch> | ||||
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
State Changed From-To: open->closed Committed! |
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