mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
Fix use of unsetenv(3) on Tru64.
* configure.in: Check for the declaration of unsetenv(3), which Tru64 5.1b doesn't have. * libguile/posix.c: Include <stdlib.h> since that's where POSIX says unsetenv(3) should reside. (scm_putenv): Don't attempt to use unsetenv(3) if its declaration isn't available since that wouldn't work well on Tru64.
This commit is contained in:
parent
5260808c9d
commit
df2870d385
2 changed files with 9 additions and 4 deletions
|
@ -730,10 +730,14 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime
|
|||
# the DECL is checked because Solaris 10 doens't have in any header
|
||||
# strncasecmp - on NetBSD 1.6 the symbol is available in libc but the
|
||||
# declaration cannot be found
|
||||
# unsetenv - on Tru64 5.1b the symbol is available in libc but the
|
||||
# declaration is only found if `_BSD' is defined; it's marked as
|
||||
# discouraged in <stdlib.h> and has type `void' instead of `int'
|
||||
# anyway.
|
||||
#
|
||||
AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h)
|
||||
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
|
||||
AC_CHECK_DECLS([sethostname, strncasecmp])
|
||||
AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv])
|
||||
|
||||
# crypt() may or may not be available, for instance in some countries there
|
||||
# are restrictions on cryptography.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -21,6 +21,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -1335,7 +1336,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
|
|||
/* We want no "=" in the argument to mean remove the variable from the
|
||||
environment, but not all putenv()s understand this, for example
|
||||
FreeBSD 4.8 doesn't. Getting it happening everywhere is a bit
|
||||
painful. What unsetenv() exists, we use that, of course.
|
||||
painful. When unsetenv() exists, we use that, of course.
|
||||
|
||||
Traditionally putenv("NAME") removes a variable, for example that's
|
||||
what we have to do on Solaris 9 (it doesn't have an unsetenv).
|
||||
|
@ -1359,7 +1360,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
|
|||
build would be to try "NAME" then "NAME=" at runtime, if that's not
|
||||
too much like overkill. */
|
||||
|
||||
#if HAVE_UNSETENV
|
||||
#if defined HAVE_UNSETENV && HAVE_DECL_UNSETENV
|
||||
/* when unsetenv() exists then we use it */
|
||||
unsetenv (c_str);
|
||||
free (c_str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue