X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fgetenv.hpp;h=d37db05fc72ba53f8e8fcd65244666213876484d;hb=28f23191dcbf047429d51950a337a57d7a3f866a;hp=18b5dee97d9ab750f79e0ee0c7f3c26fe1147927;hpb=cd9adb8b829564212158943a0d279bb35322ab30;p=lttng-tools.git diff --git a/src/common/compat/getenv.hpp b/src/common/compat/getenv.hpp index 18b5dee97..d37db05fc 100644 --- a/src/common/compat/getenv.hpp +++ b/src/common/compat/getenv.hpp @@ -8,23 +8,22 @@ * */ +#include + #include -#include #include -#include +#include -static inline -int lttng_is_setuid_setgid() +static inline int lttng_is_setuid_setgid() { return geteuid() != getuid() || getegid() != getgid(); } -static inline -char *lttng_secure_getenv(const char *name) +static inline char *lttng_secure_getenv(const char *name) { if (lttng_is_setuid_setgid()) { WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.", - name); + name); return nullptr; } return getenv(name);