gettime: Use secure_getenv over getenv.

This commit is contained in:
Chris Lamb 2019-03-31 15:59:45 +01:00
parent fe34a2a0e4
commit 3d921155e0
4 changed files with 11 additions and 1 deletions

1
README
View File

@ -51,6 +51,7 @@ Brian R. Gaeke <brg@dgate.org>
Calle Karlsson <ckn@kash.se> Calle Karlsson <ckn@kash.se>
Chip Rosenthal <chip@unicom.com> Chip Rosenthal <chip@unicom.com>
Chris Evans <lady0110@sable.ox.ac.uk> Chris Evans <lady0110@sable.ox.ac.uk>
Chris Lamb <chris@chris-lamb.co.uk>
Cristian Gafton <gafton@sorosis.ro> Cristian Gafton <gafton@sorosis.ro>
Dan Walsh <dwalsh@redhat.com> Dan Walsh <dwalsh@redhat.com>
Darcy Boese <possum@chardonnay.niagara.com> Darcy Boese <possum@chardonnay.niagara.com>

View File

@ -110,6 +110,9 @@ AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr) AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
AC_CHECK_FUNC(setpgrp) AC_CHECK_FUNC(setpgrp)
AC_CHECK_FUNC(secure_getenv, [AC_DEFINE(HAS_SECURE_GETENV,
1,
[Defined to 1 if you have the declaration of 'secure_getenv'])])
if test "$ac_cv_header_shadow_h" = "yes"; then if test "$ac_cv_header_shadow_h" = "yes"; then
AC_CACHE_CHECK(for working shadow group support, AC_CACHE_CHECK(for working shadow group support,

View File

@ -382,4 +382,10 @@ extern char *strerror ();
# endif # endif
#endif #endif
#ifdef HAVE_SECURE_GETENV
# define shadow_getenv(name) secure_getenv(name)
# else
# define shadow_getenv(name) getenv(name)
#endif
#endif /* _DEFINES_H_ */ #endif /* _DEFINES_H_ */

View File

@ -52,7 +52,7 @@
unsigned long long epoch; unsigned long long epoch;
fallback = time (NULL); fallback = time (NULL);
source_date_epoch = getenv ("SOURCE_DATE_EPOCH"); source_date_epoch = shadow_getenv ("SOURCE_DATE_EPOCH");
if (!source_date_epoch) if (!source_date_epoch)
return fallback; return fallback;