avoid setting errno when checking for tty
authorRich Felker <dalias@aerifal.cx>
Fri, 15 Apr 2011 16:04:13 +0000 (12:04 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 15 Apr 2011 16:04:13 +0000 (12:04 -0400)
setting errno here is completely valid, but some programs, notably
busybox printf, assume that errno will not be set during output and
treat this as an error condition. in any case, skipping it slightly
reduces code size and saves time.

src/stdio/__fdopen.c
src/stdio/__stdout_write.c

index 235d348..a010267 100644 (file)
@@ -30,7 +30,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, TCGETS, &tio))
+       if (!(f->flags & F_NOWR) && !__syscall(SYS_ioctl, fd, TCGETS, &tio))
                f->lbf = '\n';
 
        /* Initialize op ptrs. No problem if some are unneeded. */
index 4683ffc..0cf7123 100644 (file)
@@ -4,7 +4,7 @@ size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
 {
        struct termios tio;
        f->write = __stdio_write;
-       if (!(f->flags & F_SVB) && syscall(SYS_ioctl, f->fd, TCGETS, &tio))
+       if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TCGETS, &tio))
                f->lbf = -1;
        return __stdio_write(f, buf, len);
 }