Skip to content

Commit fa84eb1

Browse files
committed
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
1 parent a73383e commit fa84eb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

util/env_posix.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ class PosixSequentialFile: public SequentialFile {
174174

175175
virtual Status Read(size_t n, Slice* result, char* scratch) {
176176
Status s;
177-
size_t r = -1;
177+
size_t r = 0;
178178
do {
179179
r = fread_unlocked(scratch, 1, n, file_);
180-
} while (r < 0 && errno == EINTR);
180+
} while (r == 0 && ferror(file_) && errno == EINTR);
181181
*result = Slice(scratch, r);
182182
if (r < n) {
183183
if (feof(file_)) {

0 commit comments

Comments
 (0)