From fa84eb1f7b0a17adf0110eed686b2b03efd3818b Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Tue, 1 Apr 2014 11:09:06 -0700 Subject: [PATCH] Fixed a compile error which tries to check whether a size_t < 0 in env_posix.cc Summary: Fixed a compile error which tries to check whether a size_t < 0 in env_posix.cc util/env_posix.cc:180:16: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] } while (r < 0 && errno == EINTR); ~ ^ ~ 1 error generated. Test Plan: make check all Reviewers: igor, haobo Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D17379 --- util/env_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index 4935e47f8..bce9526a6 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -174,10 +174,10 @@ class PosixSequentialFile: public SequentialFile { virtual Status Read(size_t n, Slice* result, char* scratch) { Status s; - size_t r = -1; + size_t r = 0; do { r = fread_unlocked(scratch, 1, n, file_); - } while (r < 0 && errno == EINTR); + } while (r == 0 && ferror(file_) && errno == EINTR); *result = Slice(scratch, r); if (r < n) { if (feof(file_)) {