]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
configure, lib: Remove workarounds for unsetenv()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 20 Jan 2021 18:51:56 +0000 (20:51 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 10 May 2021 06:30:45 +0000 (09:30 +0300)
It's in POSIX.1-2001 and available on all modern systems.

configure.ac
m4/unsetenv.m4 [deleted file]
src/lib/env-util.c

index 4cbcef6c2a14cc7b38b3e5f096eb29cf3bbc8536..5b7580c8427e897a5a9db953643a8650b1a82d12 100644 (file)
@@ -320,7 +320,7 @@ AC_DEFINE(PACKAGE_WEBPAGE, "http://www.dovecot.org/", [Support URL])
 
 dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
 AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
-               strcasecmp stricmp vsyslog writev pread uname unsetenv \
+               strcasecmp stricmp vsyslog writev pread uname \
               setrlimit setproctitle seteuid setreuid setegid setresgid \
               getmntinfo setpriority quotactl getmntent kqueue kevent \
               backtrace_symbols walkcontext dirfd clearenv \
@@ -487,8 +487,6 @@ DOVECOT_FD_PASSING
 
 DOVECOT_SENDFILE
 
-DOVECOT_UNSETENV_RET_INT
-
 DOVECOT_CRYPT_XPG6
 DOVECOT_CRYPT
 
diff --git a/m4/unsetenv.m4 b/m4/unsetenv.m4
deleted file mode 100644 (file)
index e02b57c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-AC_DEFUN([DOVECOT_UNSETENV_RET_INT], [
-  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
-])
index 6c12970f4365d7b3e2f670d537102ee2b57c010d..490e4f6260eab6c7390d044da6751ba5c84879ae 100644 (file)
@@ -35,29 +35,8 @@ void env_put_array(const char *const *envs)
 
 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;
-       size_t len;
-       char **envp;
-
-       len = strlen(name);
-       for (envp = environ; *envp != NULL; envp++) {
-               if (strncmp(name, *envp, len) == 0 &&
-                   (*envp)[len] == '=') {
-                       do {
-                               envp[0] = envp[1];
-                       } while (*++envp != NULL);
-                       break;
-               }
-       }
-#endif
 }
 
 void env_clean(void)