2013-06-14 17:16:02 +02:00
|
|
|
Index: configure.ac
|
|
|
|
===================================================================
|
2020-08-16 01:52:30 +02:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
|
|
|
@@ -9,7 +9,6 @@
|
|
|
|
AM_INIT_AUTOMAKE([1.10 foreign -Wall])
|
|
|
|
|
2013-02-14 23:02:50 +01:00
|
|
|
AC_PROG_CC_STDC
|
|
|
|
-AC_PROG_CC
|
2020-08-16 01:52:30 +02:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
AM_PROG_AR
|
|
|
|
|
|
|
|
Index: src/system.h
|
2013-06-14 17:16:02 +02:00
|
|
|
===================================================================
|
2020-08-16 01:52:30 +02:00
|
|
|
--- a/src/system.h
|
|
|
|
+++ b/src/system.h
|
|
|
|
@@ -2,9 +2,7 @@
|
2013-02-14 23:02:50 +01:00
|
|
|
* \file popt/system.h
|
|
|
|
*/
|
2020-08-16 01:52:30 +02:00
|
|
|
|
2013-02-14 23:02:50 +01:00
|
|
|
-#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
-#endif
|
2020-08-16 01:52:30 +02:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
@@ -57,6 +55,8 @@
|
|
|
|
#define getenv(_s) secure_getenv(_s)
|
|
|
|
#elif defined(HAVE___SECURE_GETENV)
|
|
|
|
#define getenv(_s) __secure_getenv(_s)
|
|
|
|
+#else
|
|
|
|
+#error neither secure_getenv nor __secure_getenv is available
|
2013-02-14 23:02:50 +01:00
|
|
|
#endif
|
2020-08-16 01:52:30 +02:00
|
|
|
|
2013-02-14 23:02:50 +01:00
|
|
|
#if !defined(__GNUC__) && !defined(__attribute__)
|
2020-08-16 01:52:30 +02:00
|
|
|
|
|
|
|
Index: src/popt.c
|
2013-06-14 17:16:02 +02:00
|
|
|
===================================================================
|
2020-08-16 01:52:30 +02:00
|
|
|
--- a/src/popt.c
|
|
|
|
+++ b/src/popt.c
|
2013-02-14 23:02:50 +01:00
|
|
|
@@ -197,7 +197,7 @@ poptContext poptGetContext(const char *
|
|
|
|
con->execAbsolute = 1;
|
|
|
|
con->arg_strip = NULL;
|
|
|
|
|
|
|
|
- if (getenv("POSIXLY_CORRECT") || getenv("POSIX_ME_HARDER"))
|
|
|
|
+ if (secure_getenv("POSIXLY_CORRECT") || secure_getenv("POSIX_ME_HARDER"))
|
|
|
|
con->flags |= POPT_CONTEXT_POSIXMEHARDER;
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
@@ -442,7 +442,7 @@ const char * findProgramPath(/*@null@*/
|
|
|
|
if (strchr(argv0, '/'))
|
|
|
|
return xstrdup(argv0);
|
|
|
|
|
|
|
|
- if ((path = getenv("PATH")) == NULL || (path = xstrdup(path)) == NULL)
|
|
|
|
+ if ((path = secure_getenv("PATH")) == NULL || (path = xstrdup(path)) == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* The return buffer in t is big enough for any path. */
|
|
|
|
@@ -1706,6 +1706,7 @@ const char * poptBadOption(poptContext c
|
|
|
|
|
|
|
|
const char * poptStrerror(const int error)
|
|
|
|
{
|
|
|
|
+ char errbuf[1024];
|
|
|
|
switch (error) {
|
|
|
|
case POPT_ERROR_NOARG:
|
|
|
|
return POPT_("missing argument");
|
|
|
|
@@ -1728,7 +1729,7 @@ const char * poptStrerror(const int erro
|
|
|
|
case POPT_ERROR_BADCONFIG:
|
|
|
|
return POPT_("config file failed sanity test");
|
|
|
|
case POPT_ERROR_ERRNO:
|
|
|
|
- return strerror(errno);
|
|
|
|
+ return strerror_r(errno, errbuf, sizeof errbuf);
|
|
|
|
default:
|
|
|
|
return POPT_("unknown error");
|
|
|
|
}
|
2020-08-16 01:52:30 +02:00
|
|
|
Index: src/poptconfig.c
|
2013-06-14 17:16:02 +02:00
|
|
|
===================================================================
|
2020-08-16 01:52:30 +02:00
|
|
|
--- a/src/poptconfig.c
|
|
|
|
+++ b/src/poptconfig.c
|
2013-02-14 23:02:50 +01:00
|
|
|
@@ -540,7 +540,7 @@ int poptReadDefaultConfig(poptContext co
|
|
|
|
if (rc) goto exit;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- if ((home = getenv("HOME"))) {
|
|
|
|
+ if ((home = secure_getenv("HOME"))) {
|
|
|
|
char * fn = malloc(strlen(home) + 20);
|
|
|
|
if (fn != NULL) {
|
|
|
|
(void) stpcpy(stpcpy(fn, home), "/.popt");
|