reset mbtowc decoding state so it prints the warning once - gopher-validator - Simple gopher menu validator.
(HTM) git clone git://bitreich.org/gopher-validator git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-validator
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit d9abe6e45e708f965778fba7a66e56300fc0b814
(DIR) parent 936d0f6a5c92d6580cd15d60fac5c0e98b01e946
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 5 Jan 2021 21:50:49 +0100
reset mbtowc decoding state so it prints the warning once
Diffstat:
M gopher-validator.c | 1 +
1 file changed, 1 insertion(+), 0 deletions(-)
---
(DIR) diff --git a/gopher-validator.c b/gopher-validator.c
@@ -386,6 +386,7 @@ checkdir(FILE *fp)
if (r == 0)
break;
if (r == -1) {
+ mbtowc(NULL, NULL, 0); /* reset state */
warning("%zu:%d: username: first invalid byte, not UTF-8\n",
linenr, i + 1);
break;