aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/blaze.cc
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-09-13 07:52:01 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-09-13 12:31:58 +0000
commitcdd42274f7e6fa862f3bd3ba7115f2c9feac5d50 (patch)
tree2253ad8fcafaa6117659b0395a39847cb973e495 /src/main/cpp/blaze.cc
parentef54fb52e3b33ccf9713dca49a5bef01fc860174 (diff)
More client fixes:
- Use an explicit cast to void to tell the compiler that we are intentionally ignoring return values. - Delete the unused function GetPeerProcessId() -- MOS_MIGRATED_REVID=132970162
Diffstat (limited to 'src/main/cpp/blaze.cc')
-rw-r--r--src/main/cpp/blaze.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 9316a7f707..018e64a7af 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -830,9 +830,7 @@ static int ForwardServerOutput(int socket, int output) {
}
remaining -= bytes;
- if (write(output, server_output_buffer, bytes) != bytes) {
- // Not much we can do if this doesn't work, just placate the compiler.
- }
+ (void) write(output, server_output_buffer, bytes);
}
return 0;
@@ -1708,9 +1706,9 @@ static void SetupStreams() {
// Ensure we have three open fds. Otherwise we can end up with
// bizarre things like stdout going to the lock file, etc.
- if (fcntl(0, F_GETFL) == -1) open("/dev/null", O_RDONLY);
- if (fcntl(1, F_GETFL) == -1) open("/dev/null", O_WRONLY);
- if (fcntl(2, F_GETFL) == -1) open("/dev/null", O_WRONLY);
+ if (fcntl(STDIN_FILENO, F_GETFL) == -1) open("/dev/null", O_RDONLY);
+ if (fcntl(STDOUT_FILENO, F_GETFL) == -1) open("/dev/null", O_WRONLY);
+ if (fcntl(STDERR_FILENO, F_GETFL) == -1) open("/dev/null", O_WRONLY);
}
static void CheckBinaryPath(const string& argv0) {
@@ -2073,17 +2071,13 @@ unsigned int GrpcBlazeServer::Communicate() {
}
if (response.standard_output().size() > 0) {
- if (write(1, response.standard_output().c_str(),
- response.standard_output().size()) <= 0) {
- // Placate the compiler.
- }
+ (void) write(STDOUT_FILENO, response.standard_output().c_str(),
+ response.standard_output().size());
}
if (response.standard_error().size() > 0) {
- if (write(2, response.standard_error().c_str(),
- response.standard_error().size()) <= 0) {
- // Placate the compiler.
- }
+ (void) write(STDERR_FILENO, response.standard_error().c_str(),
+ response.standard_error().size());
}
if (!command_id_set && response.command_id().size() > 0) {