xref: /haiku/src/system/libroot/posix/unistd/access.c (revision 2f470aec1c92ce6917b8a903e343795dc77af41f)
1 /*
2 ** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 
7 #include <unistd.h>
8 #include <syscalls.h>
9 #include <errno.h>
10 
11 
12 #define RETURN_AND_SET_ERRNO(err) \
13 	if (err < 0) { \
14 		errno = err; \
15 		return -1; \
16 	} \
17 	return err;
18 
19 
20 int
21 access(const char *path, int accessMode)
22 {
23 	status_t status = _kern_access(path, accessMode);
24 
25 	RETURN_AND_SET_ERRNO(status);
26 }
27 
28