Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _DEFAULT_SOURCE /* for setgroups(2) */
- #include <Python.h>
- /*
- * Verify that Python.h defined _GNU_SOURCE, which is required for setresuid(2)
- * and setresgid(2). Defining it before including Python.h will cause a
- * diagnostic:
- *
- * warning: "_GNU_SOURCE" redefined
- *
- * So we rely on Python.h to define it, but verify that it actually did so.
- */
- #ifndef _GNU_SOURCE /* setresuid(2) & setresgid(2) */
- #error Python.h did not define _GNU_SOURCE
- #endif
- #include <grp.h>
- #include <sys/capability.h>
- #include <sys/prctl.h>
- #include <sys/types.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- /*
- * Verify that we've got the GNU-specific version of strerror_r(3)
- */
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-variable"
- #pragma GCC diagnostic error "-Wincompatible-pointer-types"
- __attribute__((unused))
- static inline void check_for_gnu_strerror_r(void)
- {
- /*
- * If this causes an 'incompatible pointer type' error, strerror_r is
- * the XSI-compliant version; we need the GNU-specific version. See
- * strerror_r(3).
- */
- char *(*foo)(int, char *, size_t) = strerror_r;
- }
- #pragma GCC diagnostic pop
Advertisement
Add Comment
Please, Sign In to add comment