fix return value of ungetc when argument is outside unsigned char range
[musl] / src / stdio / ungetc.c
index 180673a..bc629d4 100644 (file)
@@ -16,5 +16,5 @@ int ungetc(int c, FILE *f)
        f->flags &= ~F_EOF;
 
        FUNLOCK(f);
-       return c;
+       return (unsigned char)c;
 }