浏览代码

I shouldn't try to program when sleepy, since I totally botched
the fcntl interface...
-Erik

Eric Andersen 23 年之前
父节点
当前提交
ed794375b4
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      libc/stdio/stdio.c

+ 4 - 4
libc/stdio/stdio.c

@@ -203,11 +203,11 @@ void __stdio_flush_buffers(void)
 	if (WRITEABLE(fp)) {
 	    /* Set the underlying fd to non-block mode to ensure
 	     * that calls to _exit() and abort() will not block */
-	    long flags;
-	    fcntl(fp->fd, F_GETFL, &flags);
-	    fcntl(fp->fd, F_SETFL, flags|O_NONBLOCK);
+	    int opts;
+	    opts = fcntl(fp->fd, F_GETFL);
+	    fcntl(fp->fd, F_SETFL, opts|O_NONBLOCK);
 	    fflush(fp);
-	    fcntl(fp->fd, F_SETFL, flags);
+	    fcntl(fp->fd, F_SETFL, opts);
 	}
     }
 }