]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Compile fix for systems where unsetenv() returns void.
authorTimo Sirainen <tss@iki.fi>
Tue, 15 Dec 2009 19:01:20 +0000 (14:01 -0500)
committerTimo Sirainen <tss@iki.fi>
Tue, 15 Dec 2009 19:01:20 +0000 (14:01 -0500)
FreeBSD 6.4, for example.

--HG--
branch : HEAD

configure.in
src/lib/env-util.c

index 3ff45553512782033961babf37a3143a3d2507b1..1b67a13d992ffc05bcb7f93951e8dc3b9f61bfce 100644 (file)
@@ -1301,6 +1301,21 @@ AC_CHECK_LIB(sendfile, sendfile, [
   fi
 ])
 
+AC_CACHE_CHECK([if unsetenv returns int],i_cv_unsetenv_ret_int,[
+  AC_TRY_COMPILE([
+    #include <stdlib.h>
+  ], [
+    if (unsetenv("env") < 0) ;
+  ], [
+    i_cv_unsetenv_ret_int=yes
+  ], [
+    i_cv_unsetenv_ret_int=no
+  ])
+])
+if test $i_cv_unsetenv_ret_int = yes; then
+  AC_DEFINE(UNSETENV_RET_INT,, Define if unsetenv() returns int)
+fi
+
 dnl * Check for crypt() if unistd.h compiles with _XOPEN_SOURCE + _XPG6
 dnl * Add other macros there too "just in case".
 AC_CACHE_CHECK([if we should use _XPG6 macro for crypt()],i_cv_use_xpg6_crypt,[
index 643b0866e062b167025f6cd26ab593d55ea02b58..cde68c083887eed488f9efa1cdc768d56bffbe61 100644 (file)
@@ -25,8 +25,12 @@ void env_put(const char *env)
 void env_remove(const char *name)
 {
 #ifdef HAVE_UNSETENV
+#ifdef UNSETENV_RET_INT
        if (unsetenv(name) < 0)
                i_fatal("unsetenv(%s) failed: %m", name);
+#else
+       unsetenv(name);
+#endif
 #else
        extern char **environ;
        unsigned int len;