Explorar o código

putw is supposed to return 0 (not the value written) on success

this is not a standard but it's the traditional behavior and it's more
useful because the caller can reliably detect errors.
Rich Felker %!s(int64=12) %!d(string=hai) anos
pai
achega
920baab81f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/stdio/putw.c

+ 1 - 1
src/stdio/putw.c

@@ -3,5 +3,5 @@
 
 int putw(int x, FILE *f)
 {
-	return fwrite(&x, sizeof x, 1, f) ? x : EOF;
+	return (int)fwrite(&x, sizeof x, 1, f)-1;
 }