1explain_lchmod_or_die(3) Library Functions Manual explain_lchmod_or_die(3)
2
3
4
6 explain_lchmod_or_die - change permissions of a file and report errors
7
9 #include <libexplain/lchmod.h>
10 void explain_lchmod_or_die(const char *pathname, mode_t mode);
11 int explain_lchmod_on_error(const char *pathname, mode_t mode);
12
14 The explain_lchmod_or_die function is used to call the lchmod(2) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_lchmod(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_lchmod_on_error function is used to call the lchmod(2) sys‐
20 tem call. On failure an explanation will be printed to stderr, obtained
21 from the explain_lchmod(3) function, but still returns to the caller.
22
23 pathname
24 The pathname, exactly as to be passed to the lchmod(2) system
25 call.
26
27 mode The mode, exactly as to be passed to the lchmod(2) system call.
28
30 The explain_lchmod_or_die function only returns on success, see lch‐
31 mod(2) for more information. On failure, prints an explanation and
32 exits, it does not return.
33
34 The explain_lchmod_on_error function always returns the value return by
35 the wrapped lchmod(2) system call.
36
38 The explain_lchmod_or_die function is intended to be used in a fashion
39 similar to the following example:
40 explain_lchmod_or_die(pathname, mode);
41
43 lchmod(2)
44 change permissions of a file
45
46 explain_lchmod(3)
47 explain lchmod(2) errors
48
49 exit(2) terminate the calling process
50
52 libexplain version 1.4
53 Copyright (C) 2012 Peter Miller
54
55
56
57 explain_lchmod_or_die(3)