Dealing with clearenv()

Sevan / Venture37 venture37 at hotmail.com
Sun Nov 19 12:28:19 PST 2006


Chillispot 1.1 uses clearenv() which is not available in FreeBSD. What's
the best way for dealing with this, atm I'm using the following patch to
the source code which seems to work & none of the testers have reported
back with any problems. Is there a better way to deal with the issue??
+#ifdef HAVE_CLEARENV
   if (clearenv() != 0) {
     sys_err(LOG_ERR, __FILE__, __LINE__, errno,
 	    "clearenv() did not return 0!");
     exit(0);
   }
+#else
+        extern char **environ;
+	environ[0] = NULL;
+        if (environ[0] != NULL) {
+    sys_err(LOG_ERR, __FILE__, __LINE__, errno,
+            "Venture37 doesn't know what he's doing!!!");
+    exit(0);
+  }
+#endif



Sevan / Venture37
-- 
"The truth, the half-truth, and nothing like the truth." - Mark Brandon Read



More information about the freebsd-ports mailing list