aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Vaněk <arkamar@atlas.cz>2019-05-28 22:47:48 +0200
committerRich Felker <dalias@aerifal.cx>2019-08-08 11:33:18 -0400
commit7844ecb590893f8344324837956718001402d297 (patch)
tree0f35921dfe7c6e305e989be075ce228e1e540b15
parent0847902ab99065a48f9bd3729b6e676288dfd69e (diff)
downloadmusl-7844ecb590893f8344324837956718001402d297.zip
musl-7844ecb590893f8344324837956718001402d297.tar.gz
musl-7844ecb590893f8344324837956718001402d297.tar.bz2
add secure_getenv function
This function is a GNU extension introduced in glibc 2.17.
-rw-r--r--include/stdlib.h1
-rw-r--r--src/env/secure_getenv.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 42ca833..194c203 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -152,6 +152,7 @@ int ptsname_r(int, char *, size_t);
char *ecvt(double, int, int *, int *);
char *fcvt(double, int, int *, int *);
char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
struct __locale_struct;
float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
diff --git a/src/env/secure_getenv.c b/src/env/secure_getenv.c
new file mode 100644
index 0000000..72322f8
--- /dev/null
+++ b/src/env/secure_getenv.c
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include "libc.h"
+
+char *secure_getenv(const char *name)
+{
+ return libc.secure ? NULL : getenv(name);
+}