getservbyport_r: fix out-of-bounds buffer read
[musl] / src / stdio / __towrite.c
index b458741..4c9c66a 100644 (file)
@@ -3,7 +3,7 @@
 int __towrite(FILE *f)
 {
        f->mode |= f->mode-1;
-       if (f->flags & (F_NOWR)) {
+       if (f->flags & F_NOWR) {
                f->flags |= F_ERR;
                return EOF;
        }
@@ -17,5 +17,7 @@ int __towrite(FILE *f)
        return 0;
 }
 
-/* Link flush-on-exit code iff any stdio write functions are linked. */
-int (*const __fflush_on_exit)(FILE *) = fflush;
+hidden void __towrite_needs_stdio_exit()
+{
+       __stdio_exit_needed();
+}