diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:14 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:14 +0900 |
commit | 374d0b57dade4c128ca5b7e51a4b1a91d4af13aa (patch) | |
tree | 35a91b2803ca4579f1f4f1098fa55279d928ad35 /lib/vasnprintf.c | |
parent | 61fb427c104d6f2334aaee9c7d90d8287d521b17 (diff) | |
download | wget-374d0b57dade4c128ca5b7e51a4b1a91d4af13aa.tar.gz wget-374d0b57dade4c128ca5b7e51a4b1a91d4af13aa.tar.bz2 wget-374d0b57dade4c128ca5b7e51a4b1a91d4af13aa.zip |
Imported Upstream version 1.16.2upstream/1.16.2
Diffstat (limited to 'lib/vasnprintf.c')
-rw-r--r-- | lib/vasnprintf.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index ec7302a..246831f 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2014 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2015 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -5179,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* SNPRINTF or sprintf failed. Save and use the errno that it has set, if any. */ int saved_errno = errno; + if (saved_errno == 0) + { + if (dp->conversion == 'c' || dp->conversion == 's') + saved_errno = EILSEQ; + else + saved_errno = EINVAL; + } if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); - errno = - (saved_errno != 0 - ? saved_errno - : (dp->conversion == 'c' || dp->conversion == 's' - ? EILSEQ - : EINVAL)); + + errno = saved_errno; return NULL; } |