fix dup3 ignoring all flags but O_CLOEXEC on archs with SYS_dup2 syscall
[musl] / src / stdio / __towrite.c
index 380ea39..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,11 +17,7 @@ int __towrite(FILE *f)
        return 0;
 }
 
-const int __towrite_used = 1;
-
-void __stdio_exit(void);
-
-void __flush_on_exit()
+hidden void __towrite_needs_stdio_exit()
 {
-       __stdio_exit();
+       __stdio_exit_needed();
 }