ReactOS  0.4.14-dev-52-g6116262
eaccess.c
Go to the documentation of this file.
1 /* @(#)eaccess.c 1.6 14/05/15 Copyright 2004-2014 J. Schilling */
2 #include <schily/mconfig.h>
3 #ifndef lint
4 static UConst char sccsid[] =
5  "@(#)eaccess.c 1.6 14/05/15 Copyright 2004-2014 J. Schilling";
6 #endif
7 /*
8  * Implement the best possible emulation for eaccess()
9  *
10  * Copyright 2004-2014 J. Schilling
11  */
12 /*
13  * The contents of this file are subject to the terms of the
14  * Common Development and Distribution License, Version 1.0 only
15  * (the "License"). You may not use this file except in compliance
16  * with the License.
17  *
18  * See the file CDDL.Schily.txt in this distribution for details.
19  * A copy of the CDDL is also available via the Internet at
20  * http://www.opensource.org/licenses/cddl1.txt
21  *
22  * When distributing Covered Code, include this CDDL HEADER in each
23  * file and include the License file CDDL.Schily.txt from this distribution.
24  */
25 
26 #include <schily/unistd.h>
27 #include <schily/standard.h>
28 #include <schily/errno.h>
29 #include <schily/schily.h>
30 
31 #ifndef HAVE_EACCESS
32 EXPORT int eaccess __PR((const char *name, int mode));
33 
34 EXPORT int
36  const char *name;
37  int mode;
38 {
39 #ifdef HAVE_EUIDACCESS
40  return (euidaccess(name, mode));
41 #else
42 #ifdef HAVE_ACCESS_E_OK
43  return (access(name, E_OK|mode));
44 #else
45  if (getuid() == geteuid() && getgid() == getegid())
46  return (access(name, mode));
47 #ifdef EOPNOTSUPP
49 #else
51 #endif
52  return (-1);
53 #endif
54 #endif
55 }
56 #endif
Definition: arc.h:39
#define EOPNOTSUPP
Definition: errno.h:104
static UConst char sccsid[]
Definition: eaccess.c:4
#define UConst
Definition: ccomdefs.h:72
EXPORT int seterrno(int err)
Definition: seterrno.c:34
EXPORT gid_t getegid()
Definition: gid.c:37
GLenum mode
Definition: glext.h:6217
EXPORT uid_t geteuid()
Definition: uid.c:37
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
uid_t getuid()
Definition: uid.c:27
EXPORT gid_t getgid()
Definition: gid.c:27
Definition: name.c:36
EXPORT int eaccess __PR((const char *name, int mode))
#define E_OK
Definition: unistd.h:112
EXPORT int eaccess(char *name, int mode) const
Definition: eaccess.c:35
GLuint const GLchar * name
Definition: glext.h:6031