Cleaning up CYGWIN define of fread_unlocked to port

Summary: CYGWIN avoided fread_unlocked in a wrong way. Fix it to the standard way.

Test Plan: Run tests

Reviewers: anthony, kradhakrishnan, IslamAbdelRahman, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D42549
main
sdong 9 years ago
parent 26ca893198
commit 5ec829bc4f
  1. 2
      port/port_posix.h
  2. 4
      util/env_posix.cc

@ -53,7 +53,7 @@
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
defined(OS_ANDROID)
defined(OS_ANDROID) || defined(OS_CYGWIN)
// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite

@ -186,11 +186,7 @@ class PosixSequentialFile: public SequentialFile {
Status s;
size_t r = 0;
do {
#ifndef CYGWIN
r = fread_unlocked(scratch, 1, n, file_);
#else
r = fread(scratch, 1, n, file_);
#endif
} while (r == 0 && ferror(file_) && errno == EINTR);
IOSTATS_ADD(bytes_read, r);
*result = Slice(scratch, r);

Loading…
Cancel
Save