diff options
| author | Rich Felker <dalias@aerifal.cx> | 2018-10-18 13:33:11 -0400 | 
|---|---|---|
| committer | Rich Felker <dalias@aerifal.cx> | 2018-10-18 13:36:43 -0400 | 
| commit | a21a6092cfc0c7e7cb8c0273e5f94d54c0e0eabd (patch) | |
| tree | 84ffe8c11658cccb19f5b68897f78f7eb221d752 | |
| parent | 9dd19122565c70bc6e0fff35724c91a61209a629 (diff) | |
| download | musl-a21a6092cfc0c7e7cb8c0273e5f94d54c0e0eabd.tar.gz | |
fix wrong result for putc variants due to operator precedence
the internal putc_unlocked macro was wrongly returning a meaningless
boolean result rather than the written character or EOF.
bug was found by reading (very surprising) asm.
| -rw-r--r-- | src/internal/stdio_impl.h | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h index ab34da2a..44497344 100644 --- a/src/internal/stdio_impl.h +++ b/src/internal/stdio_impl.h @@ -105,7 +105,7 @@ hidden void __getopt_msg(const char *, const char *, const char *, size_t);  	( ((f)->rpos != (f)->rend) ? *(f)->rpos++ : __uflow((f)) )  #define putc_unlocked(c, f) \ -	( ((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend) \ +	( (((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend)) \  	? *(f)->wpos++ = (c) : __overflow((f),(c)) )  /* Caller-allocated FILE * operations */ | 
