To review, tcc does not really use environ, so you have to use clearenv
there. But POSIX, in their wisdom, didn't standardise clearenv yet,
so on FreeBSD, one still needs to manipulate environ on their own.
(If you use tcc on FreeBSD, this may leave you unsatisfied.)
#include <string.h>
#include <sys/file.h>
#include <string.h>
#include <sys/file.h>
char *newenviron[$#envsave+6];
int i=0;
char *newenviron[$#envsave+6];
int i=0;
newenviron[i++]="HOME=$ENV{HOME}";
newenviron[i++]="WRAPPED_OPTIONS=$configstring";
newenviron[i++]="HOME=$ENV{HOME}";
newenviron[i++]="WRAPPED_OPTIONS=$configstring";
if (clearenv() != 0) {
perror("clearenv");
exit(1);
}
for (; i>0; i--)
putenv(newenviron[i-1]);
if (clearenv() != 0) {
perror("clearenv");
exit(1);
}
for (; i>0; i--)
putenv(newenviron[i-1]);
+#else
+ newenviron[i]=NULL;
+ environ=newenviron;
+#endif
if (setregid(getegid(), -1) != 0 &&
setregid(getegid(), -1) != 0) {
if (setregid(getegid(), -1) != 0 &&
setregid(getegid(), -1) != 0) {
When build wrapper on FreeBSD system, is error occured with clearenv reference. clearenv() das not exists at FreeBSD system, use workaround environ[0]=NULL;
P.S. new git instalation, FreeBSD 7.x
When build wrapper on FreeBSD system, is error occured with clearenv reference. clearenv() das not exists at FreeBSD system, use workaround environ[0]=NULL;
P.S. new git instalation, FreeBSD 7.x
+
+> #include <stupid-standards.h> fixed with nasty ifdefs to handle tcc w/o
+> breaking everything else. ||done]] --[[Joey]]