File: usercheck.c

package info (click to toggle)
nn 6.7.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,480 kB
  • ctags: 3,198
  • sloc: ansic: 32,028; sh: 1,491; awk: 138; makefile: 96
file content (17 lines) | stat: -rw-r--r-- 268 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>


/* check for whether caller is a specific uid (numeric) */

int
main(int argc, char *argv[])
{
    int             uid = 0;

    if (argc > 1)
	uid = atoi(argv[1]);

    exit(getuid() == uid ? 0 : 1);
}