Files
RedBear-OS/tests/unistd/setid.c
T
Tibor Nagy 4381bb2a22 tests: Remove redundant return statements
When the execution reaches the end of the main functions, they implicitly return a successful status.
2019-02-20 21:09:03 +01:00

25 lines
575 B
C

/*
* The process joins process group 0.
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(void) {
if( setpgid( getpid(), 0 ) == -1 ) {
perror( "setpgid" );
}
printf( "%d belongs to process group %d\n",
getpid(), getpgrp() );
if( setregid(-1, -1) == -1 ) {
perror( "setregid" );
}
printf("%d has egid %d and gid %d\n", getpid(), getegid(), getgid());
if( setreuid(-1, -1) == -1 ) {
perror( "setreuid" );
}
printf("%d has euid %d and uid %d\n", getpid(), geteuid(), getuid());
}