Skip to content

Commit

Permalink
glibc needs _SVID_SOURCE to define putenv() and clearenv()
Browse files Browse the repository at this point in the history
  • Loading branch information
comotion committed Oct 19, 2012
1 parent 54a5691 commit 420275a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions cpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
#include "config.h"
#define _GNU_SOURCE

#ifdef HAVE_STDLIB_H
#ifndef _SVID_SOURCE
#define _SVID_SOURCE
#endif
#include <stdlib.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
Expand All @@ -43,9 +49,6 @@
#endif
#include <signal.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRINGS_H
#include <string.h>
#endif
Expand Down
5 changes: 3 additions & 2 deletions security.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
/* #############################################################################
* includes
*/
#include <sys/utsname.h>

#include "cpm.h"
#include <sys/utsname.h>
#if defined(HAVE_SYS_PRCTL_H)
#include <sys/ptrace.h>
#include <sys/prctl.h>
Expand Down Expand Up @@ -497,7 +498,7 @@ int initSecurity(int* max_mem_lock, int* memory_safe, int* ptrace_safe,
*memory_safe = 0;
*ptrace_safe = 0;

#ifdef _SYS_PTRACE_H
#if defined(_SYS_PTRACE_H) && !defined(TRACE_DEBUG)
/* Try to fork a child which then ptrace attaches to it's parent
* This will safely prevent other processes (even root) to be able to attach to us */
{
Expand Down

0 comments on commit 420275a

Please sign in to comment.