From 13fd045dbb2b4dacea32be162a41d5a4b0d1802f Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 12 Sep 2017 10:32:01 -0700 Subject: Integrated internal changes from Google --- src/google/protobuf/testing/file.cc | 2 +- src/google/protobuf/testing/zcgunzip.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/google/protobuf/testing') diff --git a/src/google/protobuf/testing/file.cc b/src/google/protobuf/testing/file.cc index f32222b7..f68aba9a 100644 --- a/src/google/protobuf/testing/file.cc +++ b/src/google/protobuf/testing/file.cc @@ -121,7 +121,7 @@ void File::WriteStringToFileOrDie(const string& contents, const string& name) { bool File::CreateDir(const string& name, int mode) { if (!name.empty()) { - GOOGLE_CHECK_OK(name.back() != '.'); + GOOGLE_CHECK_OK(name[name.size() - 1] != '.'); } return mkdir(name.c_str(), mode) == 0; } diff --git a/src/google/protobuf/testing/zcgunzip.cc b/src/google/protobuf/testing/zcgunzip.cc index 76f8cfe1..349ad86e 100644 --- a/src/google/protobuf/testing/zcgunzip.cc +++ b/src/google/protobuf/testing/zcgunzip.cc @@ -72,7 +72,10 @@ int main(int argc, const char** argv) { } if (inlen > 0) { int err = write(STDOUT_FILENO, inptr, inlen); - assert(err == inlen); + if (err != inlen) { + fprintf(stderr, "write unexpectedly returned %d.\n", err); + return 1; + } } } -- cgit v1.2.3