summaryrefslogtreecommitdiff
path: root/lib/putenv.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-12-06 22:18:17 +0000
committerJim Meyering <jim@meyering.net>1998-12-06 22:18:17 +0000
commit2ec7385fb05fa128ba0056543134511e8281c8fd (patch)
tree477de2e8f1b83815337ba537e2eb8664413f436a /lib/putenv.c
parent46dd5092eeeae1c4e81d94a54f9c0fd9d798a328 (diff)
downloadcoreutils-2ec7385fb05fa128ba0056543134511e8281c8fd.tar.xz
Redefine putenv before including stdlib.h to work
around Solaris 2.7's conflicting prototype. Reported by Karl Berry.
Diffstat (limited to 'lib/putenv.c')
-rw-r--r--lib/putenv.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/putenv.c b/lib/putenv.c
index f1974d50f..77f720f82 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -31,8 +31,14 @@
#include <sys/types.h>
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
+/* Some stdlib.h (e.g., Solaris 2.7) declare putenv with a non-const argument.
+ Since that would conflict with the declaration below, we rename putenv in
+ that incompatible prototype. */
+# define putenv vendor_putenv_prototype
# include <stdlib.h>
+# undef putenv
#endif
+
#if defined (__GNU_LIBRARY__) || defined (HAVE_STRING_H)
# include <string.h>
#endif
@@ -60,8 +66,7 @@ extern char **environ;
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int
-rpl_putenv (string)
- const char *string;
+rpl_putenv (const char *string)
{
const char *const name_end = strchr (string, '=');
register size_t size;