1explain_setgid_or_die(3) Library Functions Manual explain_setgid_or_die(3)
2
3
4
6 explain_setgid_or_die - set group identity and report errors
7
9 #include <libexplain/setgid.h>
10 void explain_setgid_or_die(gid_t gid);
11 int explain_setgid_on_error(gid_t gid);
12
14 The explain_setgid_or_die function is used to call the setgid(2) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_setgid(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_setgid_on_error function is used to call the setgid(2) sys‐
20 tem call. On failure an explanation will be printed to stderr, obtained
21 from the explain_setgid(3) function, but still returns to the caller.
22
23 gid The gid, exactly as to be passed to the setgid(2) system call.
24
26 The explain_setgid_or_die function only returns on success, see set‐
27 gid(2) for more information. On failure, prints an explanation and
28 exits, it does not return.
29
30 The explain_setgid_on_error function always returns the value return by
31 the wrapped setgid(2) system call.
32
34 The explain_setgid_or_die function is intended to be used in a fashion
35 similar to the following example:
36 explain_setgid_or_die(gid);
37
39 setgid(2)
40 set group identity
41
42 explain_setgid(3)
43 explain setgid(2) errors
44
45 exit(2) terminate the calling process
46
48 libexplain version 1.4
49 Copyright (C) 2012 Peter Miller
50
51
52
53 explain_setgid_or_die(3)