[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Use of environ in lib/signature.c
- From: Albert Chin <rpm-list thewrittenword com>
- To: rpm-list redhat com
- Subject: Use of environ in lib/signature.c
- Date: Sun, 12 May 2002 17:25:53 -0500
>From 4.0.4, in lib/signature.c, we have:
execve(BLAH, BLAH, environ);
Isn't this the same as:
execv(BLAH, BLAH)?
Solaris does not automatically define:
extern char **environ
in <unistd.h> (a weak reference does exist in libc though).
This is fixed in the rpm-4_0 branch by a change to system.h:
#if !defined(__GLIBC__)
extern char ** environ;
#endif
However, wouldn't the attached patch be better?
--
albert chin (china@thewrittenword.com)
-- snip snip
--- configure.in.orig Sun May 12 14:24:56 2002
+++ configure.in Sun May 12 17:02:06 2002
@@ -744,6 +726,22 @@
AC_CHECK_FUNCS(regcomp)
AC_CHECK_FUNCS(ftok)
+
+dnl
+dnl Check for 'extern char **environ' definition used by
+dnl lib/signature.c in execve().
+dnl
+AC_MSG_CHECKING([for char **environ])
+AC_TRY_LINK([#include <unistd.h>],[
+char **e = environ],[
+ AC_MSG_RESULT(yes)],[
+ AC_TRY_LINK([#include <unistd.h>
+extern char **environ;],[
+char **e = environ],[
+ AC_DEFINE_UNQUOTED(NEED_ENVIRON_DEF, 1,
+ [Define if extern char **environ definition needed])
+ AC_MSG_RESULT(yes, but need to define it first)],[
+ AC_MSG_RESULT(no)])])
dnl
dnl XXX Regex replacement isn't known to be needed yet.
--- system.h.orig Sun May 12 16:56:53 2002
+++ system.h Sun May 12 17:03:06 2002
@@ -28,6 +28,9 @@
/*@modifies errno, systemState @*/;
/*@=superuser =declundef =incondefs @*/
#endif
+#ifdef NEED_ENVIRON_DEF
+extern char **environ;
+#endif
#endif
#if TIME_WITH_SYS_TIME
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]