build - find environe and build when found

meson didnt look for environ thus it was never found and defined. this
is a fallback for having no clearenv() so essentially no os work
talking about is in this situation anymore.
devs/bu5hm4n/pointer-fix
Carsten Haitzler 1 year ago
parent 7e02c59a43
commit 56d2cdc294
  1. 11
      meson.build
  2. 2
      src/bin/e_util_suid.h

@ -198,6 +198,17 @@ endif
dep_fnmatch = cc.find_library('fnmatch', required: false)
code = '''#define _GNU_SOURCE 1
#include <unistd.h>
#include <stdio.h>
extern char **environ;
void func(void) { printf("%p\n", environ); }
'''
if cc.compiles(code, args : '-lc', name : 'environ check')
config_h.set10('HAVE_ENVIRON', true)
endif
add_global_arguments('-DPACKAGE_BIN_DIR="@0@"'.format(dir_bin), language: 'c')
add_global_arguments('-DPACKAGE_LIB_DIR="@0@"'.format(dir_lib), language: 'c')
add_global_arguments('-DPACKAGE_DATA_DIR="@0@"'.format(join_paths(dir_data, proj)), language: 'c')

@ -198,7 +198,7 @@ e_setuid_setup(uid_t *caller_uid, gid_t *caller_gid, char **caller_user, char **
# ifdef HAVE_ENVIRON
if (environ)
{
int again;
int i, again;
// go over environment array again and again... safely
do
{

Loading…
Cancel
Save