diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:50:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-28 12:50:39 +0100 |
| commit | e7dd07c8025b169b7b43b955066a7200d9cdf244 (patch) | |
| tree | 6e8c927cfc67f3708b91ac79df07707af26e4929 /gl/printf-args.c | |
| parent | 828a9720b10814c5836d03aa35af05d196c4104b (diff) | |
| parent | b0afb8fe0ff1d87165af9df61501197a06240dda (diff) | |
| download | monitoring-plugins-e7dd07c8025b169b7b43b955066a7200d9cdf244.tar.gz | |
Merge pull request #2213 from RincewindsHat/update/gnulib
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/printf-args.c')
| -rw-r--r-- | gl/printf-args.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gl/printf-args.c b/gl/printf-args.c index eb0d2cdc..b83ec1e8 100644 --- a/gl/printf-args.c +++ b/gl/printf-args.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Decomposed printf argument list. | 1 | /* Decomposed printf argument list. |
| 2 | Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2024 Free Software | 2 | Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2025 Free Software |
| 3 | Foundation, Inc. | 3 | Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| @@ -32,6 +32,9 @@ | |||
| 32 | /* Get INT_WIDTH. */ | 32 | /* Get INT_WIDTH. */ |
| 33 | #include <limits.h> | 33 | #include <limits.h> |
| 34 | 34 | ||
| 35 | /* Get abort(). */ | ||
| 36 | #include <stdlib.h> | ||
| 37 | |||
| 35 | #ifdef STATIC | 38 | #ifdef STATIC |
| 36 | STATIC | 39 | STATIC |
| 37 | #endif | 40 | #endif |
| @@ -198,7 +201,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a) | |||
| 198 | if (ap->a.a_string == NULL) | 201 | if (ap->a.a_string == NULL) |
| 199 | ap->a.a_string = "(NULL)"; | 202 | ap->a.a_string = "(NULL)"; |
| 200 | break; | 203 | break; |
| 201 | #if HAVE_WCHAR_T | ||
| 202 | case TYPE_WIDE_STRING: | 204 | case TYPE_WIDE_STRING: |
| 203 | ap->a.a_wide_string = va_arg (args, const wchar_t *); | 205 | ap->a.a_wide_string = va_arg (args, const wchar_t *); |
| 204 | /* A null pointer is an invalid argument for "%ls", but in practice | 206 | /* A null pointer is an invalid argument for "%ls", but in practice |
| @@ -216,7 +218,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a) | |||
| 216 | ap->a.a_wide_string = wide_null_string; | 218 | ap->a.a_wide_string = wide_null_string; |
| 217 | } | 219 | } |
| 218 | break; | 220 | break; |
| 219 | #endif | ||
| 220 | case TYPE_POINTER: | 221 | case TYPE_POINTER: |
| 221 | ap->a.a_pointer = va_arg (args, void *); | 222 | ap->a.a_pointer = va_arg (args, void *); |
| 222 | break; | 223 | break; |
| @@ -298,9 +299,19 @@ PRINTF_FETCHARGS (va_list args, arguments *a) | |||
| 298 | } | 299 | } |
| 299 | break; | 300 | break; |
| 300 | #endif | 301 | #endif |
| 301 | default: | 302 | case TYPE_NONE: |
| 302 | /* Unknown type. */ | 303 | /* Argument i is not used by any directive, but some argument with |
| 304 | number > i is used by a format directive. POSIX says that this | ||
| 305 | is invalid: | ||
| 306 | "When numbered argument specifications are used, specifying the | ||
| 307 | Nth argument requires that all the leading arguments, from the | ||
| 308 | first to the (N-1)th, are specified in the format string." | ||
| 309 | The reason is that we cannot know how many bytes to skip in the | ||
| 310 | va_arg sequence. */ | ||
| 303 | return -1; | 311 | return -1; |
| 312 | default: | ||
| 313 | /* Unknown type. Should not happen. */ | ||
| 314 | abort (); | ||
| 304 | } | 315 | } |
| 305 | return 0; | 316 | return 0; |
| 306 | } | 317 | } |
