[tz] [PROPOSED PATCH] port 'environ' decl to Solaris 10

Paul Eggert eggert at cs.ucla.edu
Mon Sep 5 00:27:28 UTC 2016


POSIX says apps must declare 'environ' themselves.  Although this
is not necessary on GNU/Linux with _GNU_SOURCE defined, it is
needed with stricter environments like Solaris 10.
* date.c, zdump.c (environ): Declare even if HAVE_POSIX_DECLS.
---
 date.c  | 3 ++-
 zdump.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/date.c b/date.c
index 4c11f61..512d1ef 100644
--- a/date.c
+++ b/date.c
@@ -42,8 +42,9 @@
 #define SECSPERMIN	60
 #endif /* !defined SECSPERMIN */
 
-#if !HAVE_POSIX_DECLS
 extern char **		environ;
+
+#if !HAVE_POSIX_DECLS
 extern char *		optarg;
 extern int		optind;
 extern char *		tzname[];
diff --git a/zdump.c b/zdump.c
index 694b04f..f68ba3d 100644
--- a/zdump.c
+++ b/zdump.c
@@ -258,8 +258,9 @@ enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
 # define timezone_t char **
 #endif
 
-#if !HAVE_POSIX_DECLS
 extern char **	environ;
+
+#if !HAVE_POSIX_DECLS
 extern int	getopt(int argc, char * const argv[],
 			const char * options);
 extern char *	optarg;
-- 
2.7.4




More information about the tz mailing list