ReactOS 0.4.15-dev-6661-gcc6e444
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
4static 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
32EXPORT int eaccess __PR((const char *name, int mode));
33
34EXPORT 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
#define EINVAL
Definition: acclib.h:90
uid_t getuid()
Definition: uid.c:27
#define UConst
Definition: ccomdefs.h:72
#define EOPNOTSUPP
Definition: errno.h:104
static UConst char sccsid[]
Definition: eaccess.c:4
EXPORT int eaccess(char *name, int mode) const
Definition: eaccess.c:35
EXPORT gid_t getegid()
Definition: gid.c:37
EXPORT gid_t getgid()
Definition: gid.c:27
GLenum mode
Definition: glext.h:6217
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define __PR(a)
Definition: prototyp.h:106
EXPORT int seterrno(int err)
Definition: seterrno.c:34
Definition: name.c:39
#define E_OK
Definition: unistd.h:112
EXPORT uid_t geteuid()
Definition: uid.c:37