]> sipb.mit.edu Git - ikiwiki.git/commitdiff
use __TINYC__ define to avoid tinyc compat fixes breaking FreeBSD
authorJoey Hess <joey@gnu.kitenet.net>
Sun, 28 Mar 2010 22:27:23 +0000 (18:27 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sun, 28 Mar 2010 22:27:23 +0000 (18:27 -0400)
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.)

IkiWiki/Wrapper.pm
doc/bugs/clearenv_not_present_at_FreeBSD_.mdwn

index f175b4a0ba168242ebb8396d6608cdb001cb0b34..3f3e63ca6b9957440dc45c81a1e4721b66559221 100644 (file)
@@ -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) {
index 6ad7975ebad2e76c9936b88418538b1033cdd94e..c2355d6aa8eb76c7df3be232318a693931aca6b2 100644 (file)
@@ -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]]