aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Wrapper.pm6
-rw-r--r--doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn3
2 files changed, 9 insertions, 0 deletions
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index f175b4a0b..3f3e63ca6 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -101,6 +101,7 @@ EOF
#include <string.h>
#include <sys/file.h>
+extern char **environ;
char *newenviron[$#envsave+6];
int i=0;
@@ -121,12 +122,17 @@ $envsave
newenviron[i++]="HOME=$ENV{HOME}";
newenviron[i++]="WRAPPED_OPTIONS=$configstring";
+#ifdef __TINYC__
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) {
diff --git a/doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn b/doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn
index 6ad7975eb..c2355d6aa 100644
--- a/doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn
+++ b/doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn
@@ -1,2 +1,5 @@
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]]