From c57844b08bced71778f38f2346464c3e0836287c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 1 Nov 2019 22:06:40 +0100 Subject: Add some functions and add functions with _failed suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- putenv.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'putenv.c') 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) { -- cgit v1.2.3-70-g09d2