aboutsummaryrefslogtreecommitdiffstats
path: root/putenv.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-11-01 22:06:40 +0100
committerMattias Andrée <maandree@kth.se>2019-11-01 22:06:40 +0100
commitc57844b08bced71778f38f2346464c3e0836287c (patch)
treee3733b4c99818ee6c77ed3d4d37becf30f92268f /putenv.c
parentUse installed liberror (diff)
downloadliberror-libc-c57844b08bced71778f38f2346464c3e0836287c.tar.gz
liberror-libc-c57844b08bced71778f38f2346464c3e0836287c.tar.bz2
liberror-libc-c57844b08bced71778f38f2346464c3e0836287c.tar.xz
Add some functions and add functions with _failed suffix
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'putenv.c')
-rw-r--r--putenv.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/putenv.c b/putenv.c
index 18cf2cf..ad9189f 100644
--- a/putenv.c
+++ b/putenv.c
@@ -2,6 +2,26 @@
#include "internal.h"
+void
+liberror_putenv_failed(char *string)
+{
+ const char *desc;
+ if (!string) {
+ errno = EINVAL;
+ desc = "Environment string is NULL";
+ } else if (*string == '=') {
+ errno = EINVAL;
+ desc = "Environment variable name is the empty string";
+ } else if (!strchr(string, '=')) {
+ errno = EINVAL;
+ desc = "Environment does not contain an '=' symbol";
+ } else {
+ desc = "";
+ }
+ liberror_set_error_errno(desc, "putenv", errno);
+}
+
+
int
liberror_putenv(char *string)
{