[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnulib-bug
Subject:    [PATCH] putenv: port to Solaris 10
From:       Paul Eggert <eggert () cs ! ucla ! edu>
Date:       2013-03-13 7:16:36
Message-ID: 514027D4.9020704 () cs ! ucla ! edu
[Download RAW message or body]

* lib/putenv.c (_unsetenv, putenv): Use HAVE_DECL__PUTENV, not
HAVE__PUTENV.  Solaris 10 has a _putenv that's not declared and
is not what is wanted here.
* m4/putenv.m4 (gl_PREREQ_PUTENV): Check for _putenv's
declaration, not for its existence.
---
 ChangeLog    |  9 +++++++++
 lib/putenv.c | 10 +++++-----
 m4/putenv.m4 |  4 ++--
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 94ccf7c..0b9f30f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+	putenv: port to Solaris 10
+	* lib/putenv.c (_unsetenv, putenv): Use HAVE_DECL__PUTENV, not
+	HAVE__PUTENV.  Solaris 10 has a _putenv that's not declared and
+	is not what is wanted here.
+	* m4/putenv.m4 (gl_PREREQ_PUTENV): Check for _putenv's
+	declaration, not for its existence.
+
 2013-03-12  Paul Eggert  <eggert@cs.ucla.edu>
 
 	mktime: fix configure typo
diff --git a/lib/putenv.c b/lib/putenv.c
index 3813a11..5461273 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -62,7 +62,7 @@ static int
 _unsetenv (const char *name)
 {
   size_t len;
-#if !HAVE__PUTENV
+#if !HAVE_DECL__PUTENV
   char **ep;
 #endif
 
@@ -74,7 +74,7 @@ _unsetenv (const char *name)
 
   len = strlen (name);
 
-#if HAVE__PUTENV
+#if HAVE_DECL__PUTENV
   {
     int putenv_result, putenv_errno;
     char *name_ = malloc (len + 2);
@@ -127,9 +127,9 @@ putenv (char *string)
       return _unsetenv (string);
     }
 
-#if HAVE__PUTENV
+#if HAVE_DECL__PUTENV
   /* Rely on _putenv to allocate the new environment.  If other
-     parts of the application use _putenv, the !HAVE__PUTENV code
+     parts of the application use _putenv, the !HAVE_DECL__PUTENV code
      would fight over who owns the environ vector, causing a crash.  */
   if (name_end[1])
     return _putenv (string);
@@ -188,7 +188,7 @@ putenv (char *string)
       last_environ = new_environ;
       environ = new_environ;
     }
-#endif
 
   return 0;
+#endif
 }
diff --git a/m4/putenv.m4 b/m4/putenv.m4
index 03ed4f9..c33b5b5 100644
--- a/m4/putenv.m4
+++ b/m4/putenv.m4
@@ -1,4 +1,4 @@
-# putenv.m4 serial 19
+# putenv.m4 serial 20
 dnl Copyright (C) 2002-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,5 +52,5 @@ AC_DEFUN([gl_FUNC_PUTENV],
 # Prerequisites of lib/putenv.c.
 AC_DEFUN([gl_PREREQ_PUTENV],
 [
-  AC_CHECK_FUNCS([_putenv])
+  AC_CHECK_DECLS([_putenv])
 ])
-- 
1.7.11.7


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic