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
This commit is contained in:
Yueh-Hsuan Chiang 2014-04-01 11:09:06 -07:00
parent a73383e8ac
commit fa84eb1f7b

View File

@ -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_)) {