1 #ifndef _COMPAT_GETENV_H
2 #define _COMPAT_GETENV_H
5 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * SPDX-License-Identifier: LGPL-2.1-only
11 #include <common/error.hpp>
14 #include <sys/types.h>
17 static inline int lttng_is_setuid_setgid()
19 return geteuid() != getuid() || getegid() != getgid();
22 static inline char *lttng_secure_getenv(const char *name)
24 if (lttng_is_setuid_setgid()) {
25 WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.",
32 #endif /* _COMPAT_GETENV_H */