[V2,1/1] ungetc: Cast to unsigned char before returning

Submitted by wangjianjian (C) on Oct. 20, 2019, 4:43 a.m.

Details

Message ID 87f051899d0a49f1aa66f5a39c2a9100@huawei.com
State New
Series "Series without cover letter"
Headers show

Commit Message

wangjianjian (C) Oct. 20, 2019, 4:43 a.m.
Per Posix and ISO-C standard, casting to unsigned char is needed before
returning.

Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
---
 src/stdio/ungetc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.17.1

BR,
Wang Jianjian

Patch hide | download patch | download mbox

diff --git a/src/stdio/ungetc.c b/src/stdio/ungetc.c
index 180673a4..bc629d4c 100644
--- a/src/stdio/ungetc.c
+++ b/src/stdio/ungetc.c
@@ -16,5 +16,5 @@  int ungetc(int c, FILE *f)
        f->flags &= ~F_EOF;

        FUNLOCK(f);
-       return c;
+       return (unsigned char)c;
 }