From 7fc9c92bd22bf69bdf4b6b85ce6f2dc692ff0869 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aur=C3=A9lien=20Reynaud?= Date: Thu, 29 Apr 2010 09:37:57 +0200 Subject: [PATCH] Solaris 8 fixes: Fall back to putenv(3). --- configure.in | 2 +- src/exec.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index efb1e24c..0a6d25f0 100644 --- a/configure.in +++ b/configure.in @@ -477,7 +477,7 @@ AC_HEADER_TIME # Checks for library functions. # AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf) +AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv) AC_FUNC_STRERROR_R diff --git a/src/exec.c b/src/exec.c index 681b94d6..c64f949f 100644 --- a/src/exec.c +++ b/src/exec.c @@ -269,11 +269,23 @@ static void set_environment (void) /* {{{ */ { char buffer[1024]; +#ifdef HAVE_SETENV ssnprintf (buffer, sizeof (buffer), "%i", interval_g); setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1); ssnprintf (buffer, sizeof (buffer), "%s", hostname_g); setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1); +#else + ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%i", interval_g); + putenv (buffer); + + ssnprintf (buffer, sizeof (buffer), "COLLECTD_HOSTNAME=%s", hostname_g); + putenv (buffer); +#endif + +#ifdef HAVE_SETENV +#else +#endif } /* }}} void set_environment */ __attribute__((noreturn)) -- 2.11.0