[Lldb-commits] [PATCH] Enhance the Pipe interface for better portability

Oleksiy Vyalov ovyalov at google.com
Tue Dec 16 16:48:09 PST 2014


================
Comment at: source/Host/posix/ConnectionFileDescriptorPosix.cpp:297
@@ -295,1 +296,3 @@
+    Error result = m_pipe.Write("i", 1, bytes_written);
+    return result.Success();
 }
----------------
zturner wrote:
> ovyalov wrote:
> > return (result.Success() && bytes_written == 1) ?
> It seems redundant to check for bytes_written == 1.  A postcondition of Pipe::Write should be that result.Success() implies bytes_written == bytes_requested.
Quote from PipePosix::Write:


```
int result = write(fd, buf, num_bytes);
        if (result >= 0)
            bytes_written = result;
```

So, if write returns 0 Write still will be successful.

http://reviews.llvm.org/D6686

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list