| Index: base/platform_file_posix.cc
|
| diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
|
| index 9b42c7a184fea0d22ee060e1e3022c87325686c3..ec0202628e5928d92cda33ff809d75b9e9ce4cb7 100644
|
| --- a/base/platform_file_posix.cc
|
| +++ b/base/platform_file_posix.cc
|
| @@ -78,6 +78,10 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags,
|
| NOTREACHED();
|
| }
|
|
|
| + if (flags & PLATFORM_FILE_TERMINAL_DEVICE) {
|
| + open_flags |= O_NOCTTY | O_NDELAY;
|
| + }
|
| +
|
| COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero);
|
|
|
| int mode = S_IRUSR | S_IWUSR;
|
| @@ -166,6 +170,10 @@ int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) {
|
| do {
|
| rv = HANDLE_EINTR(pread(file, data + bytes_read,
|
| size - bytes_read, offset + bytes_read));
|
| + if (rv <= 0 && errno == ESPIPE) {
|
| + // The file descriptor represents a tty device. Try again without lseek.
|
| + rv = HANDLE_EINTR(read(file, data, size));
|
| + }
|
| if (rv <= 0)
|
| break;
|
|
|
| @@ -195,6 +203,10 @@ int WritePlatformFile(PlatformFile file, int64 offset,
|
| do {
|
| rv = HANDLE_EINTR(pwrite(file, data + bytes_written,
|
| size - bytes_written, offset + bytes_written));
|
| + if (rv <= 0 && errno == ESPIPE) {
|
| + // The file descriptor represents a tty device. Try again without lseek.
|
| + rv = HANDLE_EINTR(write(file, data, size));
|
| + }
|
| if (rv <= 0)
|
| break;
|
|
|
|
|