select: fix 64-bit timeout truncation on pre-time64 kernels
[musl] / src / stdio / fputs.c
index e6bdb20..1cf344f 100644 (file)
@@ -1,10 +1,10 @@
 #include "stdio_impl.h"
+#include <string.h>
 
-int fputs(const char *s, FILE *f)
+int fputs(const char *restrict s, FILE *restrict f)
 {
        size_t l = strlen(s);
-       if (!l) return 0;
-       return (int)fwrite(s, l, 1, f) - 1;
+       return (fwrite(s, 1, l, f)==l) - 1;
 }
 
 weak_alias(fputs, fputs_unlocked);