mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-11 11:37:48 +02:00
(quotearg_buffer_restyled): If mbrtowc returns
`(size_t) -1' (at which point it would also set errno to EILSEQ), then restore errno to its previous value. Reported by Phillip Jones via Tim Waugh as https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76334.
This commit is contained in:
@@ -443,6 +443,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
do
|
||||
{
|
||||
wchar_t w;
|
||||
/* Be careful not to let mbrtowc change errno. */
|
||||
int saved_errno = errno;
|
||||
size_t bytes = mbrtowc (&w, &arg[i + m],
|
||||
argsize - (i + m), &mbstate);
|
||||
if (bytes == 0)
|
||||
@@ -450,6 +452,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
else if (bytes == (size_t) -1)
|
||||
{
|
||||
printable = 0;
|
||||
/* Restore previous errno value. */
|
||||
errno = saved_errno;
|
||||
break;
|
||||
}
|
||||
else if (bytes == (size_t) -2)
|
||||
|
||||
Reference in New Issue
Block a user