tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / euidaccess.3
blobf7ce935304c0e96d451fda717613b71542325d55
1 '\" t
2 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH euidaccess 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 euidaccess, eaccess \- check effective user's permissions for a file
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
15 .B #include <unistd.h>
16 .PP
17 .BI "int euidaccess(const char *" pathname ", int " mode );
18 .BI "int eaccess(const char *" pathname ", int " mode );
19 .fi
20 .SH DESCRIPTION
21 Like
22 .BR access (2),
23 .BR euidaccess ()
24 checks permissions and existence of the file identified by its argument
25 .IR pathname .
26 However, whereas
27 .BR access (2)
28 performs checks using the real user and group identifiers of the process,
29 .BR euidaccess ()
30 uses the effective identifiers.
31 .PP
32 .I mode
33 is a mask consisting of one or more of
34 .BR R_OK ", " W_OK ", " X_OK ", and " F_OK ,
35 with the same meanings as for
36 .BR access (2).
37 .PP
38 .BR eaccess ()
39 is a synonym for
40 .BR euidaccess (),
41 provided for compatibility with some other systems.
42 .SH RETURN VALUE
43 On success (all requested permissions granted), zero is returned.
44 On error (at least one bit in
45 .I mode
46 asked for a permission that is denied, or some other error occurred),
47 \-1 is returned, and
48 .I errno
49 is set to indicate the error.
50 .SH ERRORS
51 As for
52 .BR access (2).
53 .SH VERSIONS
54 The
55 .BR eaccess ()
56 function was added in glibc 2.4.
57 .SH ATTRIBUTES
58 For an explanation of the terms used in this section, see
59 .BR attributes (7).
60 .ad l
61 .nh
62 .TS
63 allbox;
64 lbx lb lb
65 l l l.
66 Interface       Attribute       Value
68 .BR euidaccess (),
69 .BR eaccess ()
70 T}      Thread safety   MT-Safe
71 .TE
72 .hy
73 .ad
74 .sp 1
75 .SH STANDARDS
76 These functions are nonstandard.
77 Some other systems have an
78 .\" e.g., FreeBSD 6.1.
79 .BR eaccess ()
80 function.
81 .SH NOTES
82 .IR Warning :
83 Using this function to check a process's permissions on a file before
84 performing some operation based on that information leads to race conditions:
85 the file permissions may change between the two steps.
86 Generally, it is safer just to attempt the desired operation and handle
87 any permission error that occurs.
88 .PP
89 This function always dereferences symbolic links.
90 If you need to check the permissions on a symbolic link, use
91 .BR faccessat (2)
92 with the flags
93 .B AT_EACCESS
94 and
95 .BR AT_SYMLINK_NOFOLLOW .
96 .SH SEE ALSO
97 .BR access (2),
98 .BR chmod (2),
99 .BR chown (2),
100 .BR faccessat (2),
101 .BR open (2),
102 .BR setgid (2),
103 .BR setuid (2),
104 .BR stat (2),
105 .BR credentials (7),
106 .BR path_resolution (7)