add O_BINARY to all open() calls except tty_fd

cf. http://svn.netlabs.org/libc/wiki/Faq#Whydoesntreadfdbufsize_of_filereturnsize_of_file
This commit is contained in:
tg
2013-10-09 11:59:30 +00:00
parent 7f16464902
commit f920d94785
8 changed files with 28 additions and 21 deletions

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.246 2013/09/10 17:33:00 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.247 2013/10/09 11:59:27 tg Exp $");
#if HAVE_KILLPG
/*
@ -3743,7 +3743,7 @@ c_cat(const char **wp)
fn = *wp++;
if (fn[0] == '-' && fn[1] == '\0')
fd = STDIN_FILENO;
else if ((fd = open(fn, O_RDONLY)) < 0) {
else if ((fd = open(fn, O_RDONLY | O_BINARY)) < 0) {
eno = errno;
bi_errorf("%s: %s", fn, cstrerror(eno));
rv = 1;