/[path-sandbox]/trunk/src/libsandbox.c
Gentoo

Diff of /trunk/src/libsandbox.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 234 Revision 235
27 * 27 *
28 * $Header$ 28 * $Header$
29 * 29 *
30 */ 30 */
31 31
32/* Uncomment below to enable the use of strtok_r(). */
33#define REENTRANT_STRTOK 1
34
35/* Uncomment below to enable memory debugging. */ 32/* Uncomment below to enable memory debugging. */
36/* #define SB_MEM_DEBUG 1 */ 33/* #define SB_MEM_DEBUG 1 */
37 34
38#define open xxx_open 35#define open xxx_open
39#define open64 xxx_open64 36#define open64 xxx_open64
40 37
41#if !defined(BROKEN_RTLD_NEXT) && defined(HAVE_RTLD_NEXT) 38#include "config.h"
42# define USE_RTLD_NEXT
43#endif
44 39
45/* Better way would be to only define _GNU_SOURCE when __GLIBC__ is defined, 40/* Better way would be to only define _GNU_SOURCE when __GLIBC__ is defined,
46 * but including features.h and then defining _GNU_SOURCE do not work */ 41 * but including features.h and then defining _GNU_SOURCE do not work */
47#if defined(USE_RTLD_NEXT) 42#if defined(HAVE_RTLD_NEXT)
48# define _GNU_SOURCE 43# define _GNU_SOURCE
49#endif 44#endif
50#include <dirent.h> 45#include <dirent.h>
51#include <dlfcn.h> 46#include <dlfcn.h>
52#include <errno.h> 47#include <errno.h>
61#include <sys/types.h> 56#include <sys/types.h>
62#include <sys/param.h> 57#include <sys/param.h>
63#include <unistd.h> 58#include <unistd.h>
64#include <utime.h> 59#include <utime.h>
65 60
66#include "config.h"
67#include "localdecls.h" 61#include "localdecls.h"
62
63#if !defined(BROKEN_RTLD_NEXT) && defined(HAVE_RTLD_NEXT)
64# define USE_RTLD_NEXT
65#endif
68 66
69#ifdef SB_MEM_DEBUG 67#ifdef SB_MEM_DEBUG
70# include <mcheck.h> 68# include <mcheck.h>
71#endif 69#endif
72 70
1011 buffer = gstrndup(prefixes_env, prefixes_env_length); 1009 buffer = gstrndup(prefixes_env, prefixes_env_length);
1012 if (NULL == buffer) 1010 if (NULL == buffer)
1013 goto error; 1011 goto error;
1014 buffer_ptr = buffer; 1012 buffer_ptr = buffer;
1015 1013
1016#ifdef REENTRANT_STRTOK 1014#ifdef HAVE_STRTOK_R
1017 token = strtok_r(buffer_ptr, ":", &buffer_ptr); 1015 token = strtok_r(buffer_ptr, ":", &buffer_ptr);
1018#else 1016#else
1019 token = strtok(buffer_ptr, ":"); 1017 token = strtok(buffer_ptr, ":");
1020#endif 1018#endif
1021 1019
1039 } else { 1037 } else {
1040 goto error; 1038 goto error;
1041 } 1039 }
1042 } 1040 }
1043 1041
1044#ifdef REENTRANT_STRTOK 1042#ifdef HAVE_STRTOK_R
1045 token = strtok_r(NULL, ":", &buffer_ptr); 1043 token = strtok_r(NULL, ":", &buffer_ptr);
1046#else 1044#else
1047 token = strtok(NULL, ":"); 1045 token = strtok(NULL, ":");
1048#endif 1046#endif
1049 } 1047 }

Legend:
Removed from v.234  
changed lines
  Added in v.235

  ViewVC Help
Powered by ViewVC 1.1.20