Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: fusl/src/stdio/__fdopen.c

Issue 1717003002: [fusl] Don't syscall(SYS_ioctl, ...) in stdio (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fusl/src/stdio/__stdout_write.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/stdio/__fdopen.c
diff --git a/fusl/src/stdio/__fdopen.c b/fusl/src/stdio/__fdopen.c
index 3a62f30bbf237879d50c51b14942ed47c516c7f1..eb72928708db8db730b016db89f88ffa8855fbd7 100644
--- a/fusl/src/stdio/__fdopen.c
+++ b/fusl/src/stdio/__fdopen.c
@@ -1,13 +1,12 @@
#include "stdio_impl.h"
#include <stdlib.h>
-#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h>
FILE* __fdopen(int fd, const char* mode) {
FILE* f;
- struct winsize wsz;
/* Check for valid initial mode character */
if (!strchr("rwa", *mode)) {
@@ -44,7 +43,7 @@ FILE* __fdopen(int fd, const char* mode) {
/* Activate line buffered mode for terminals */
f->lbf = EOF;
- if (!(f->flags & F_NOWR) && !__syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz))
+ if (!(f->flags & F_NOWR) && isatty(fd))
f->lbf = '\n';
/* Initialize op ptrs. No problem if some are unneeded. */
« no previous file with comments | « no previous file | fusl/src/stdio/__stdout_write.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698