diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/setenv.c | |
parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz |
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/setenv.c')
-rw-r--r-- | gl/setenv.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gl/setenv.c b/gl/setenv.c index f0b8899..9e2e9e2 100644 --- a/gl/setenv.c +++ b/gl/setenv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1992, 1995-2003, 2005-2023 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
@@ -82,6 +82,7 @@ typedef int (*compar_fn_t) (const void *, const void *); | |||
82 | static void *known_values; | 82 | static void *known_values; |
83 | 83 | ||
84 | # define KNOWN_VALUE(Str) \ | 84 | # define KNOWN_VALUE(Str) \ |
85 | __extension__ \ | ||
85 | ({ \ | 86 | ({ \ |
86 | void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ | 87 | void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ |
87 | value != NULL ? *(char **) value : NULL; \ | 88 | value != NULL ? *(char **) value : NULL; \ |
@@ -375,6 +376,11 @@ rpl_setenv (const char *name, const char *value, int replace) | |||
375 | int saved_errno; | 376 | int saved_errno; |
376 | size_t len = strlen (value); | 377 | size_t len = strlen (value); |
377 | tmp = malloca (len + 2); | 378 | tmp = malloca (len + 2); |
379 | if (tmp == NULL) | ||
380 | { | ||
381 | errno = ENOMEM; | ||
382 | return -1; | ||
383 | } | ||
378 | /* Since leading '=' is eaten, double it up. */ | 384 | /* Since leading '=' is eaten, double it up. */ |
379 | *tmp = '='; | 385 | *tmp = '='; |
380 | memcpy (tmp + 1, value, len + 1); | 386 | memcpy (tmp + 1, value, len + 1); |