diff options
Diffstat (limited to 'lldb/tools/driver/Driver.cpp')
| -rw-r--r-- | lldb/tools/driver/Driver.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 854310031c3..4ed696ec1ab 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -931,7 +931,15 @@ Driver::MainLoop () #endif if (err == 0) { - if (write (fds[WRITE], commands_data, commands_size) == commands_size) + ssize_t nrwr = write(fds[WRITE], commands_data, commands_size); + if (nrwr < 0) + { + fprintf(stderr, "error: write(%i, %p, %zd) failed (errno = %i) " + "when trying to open LLDB commands pipe\n", + fds[WRITE], commands_data, commands_size, errno); + success = false; + } + else if (static_cast<size_t>(nrwr) == commands_size) { // Close the write end of the pipe so when we give the read end to // the debugger/command interpreter it will exit when it consumes all @@ -953,10 +961,18 @@ Driver::MainLoop () } else { - fprintf(stderr, "error: fdopen(%i, \"r\") failed (errno = %i) when trying to open LLDB commands pipe\n", fds[READ], errno); + fprintf(stderr, + "error: fdopen(%i, \"r\") failed (errno = %i) when " + "trying to open LLDB commands pipe\n", + fds[READ], errno); success = false; } } + else + { + assert(!"partial writes not handled"); + success = false; + } } else { |

