Skip to content

Commit e2e01f4

Browse files
committed
Fix macos build.
1 parent ecd1703 commit e2e01f4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/file/utilities.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,10 @@ int open(const path& filename, bool MSC_OR_NOAPPLE(random)) NOEXCEPT
262262
#else
263263
// open sets errno on failure.
264264
file_descriptor = ::open(path.c_str(), O_RDWR, S_IRUSR | S_IWUSR);
265+
266+
#if !defined(HAVE_APPLE)
265267
if (file_descriptor != -1)
266268
{
267-
#if !defined(HAVE_APPLE)
268269
// _O_RANDOM equivalent, posix_fadvise returns error on failure.
269270
const auto advice = random ? POSIX_FADV_RANDOM : POSIX_FADV_SEQUENTIAL;
270271
const auto result = ::posix_fadvise(file_descriptor, 0, 0, advice);
@@ -273,8 +274,8 @@ int open(const path& filename, bool MSC_OR_NOAPPLE(random)) NOEXCEPT
273274
close(file_descriptor);
274275
file_descriptor = -1;
275276
errno = result;
276-
} else
277-
#endif
277+
}
278+
else
278279
{
279280
// _SH_DENYWR equivalent.
280281
const struct flock lock{ F_WRLCK, SEEK_SET, 0, 0 };
@@ -287,7 +288,8 @@ int open(const path& filename, bool MSC_OR_NOAPPLE(random)) NOEXCEPT
287288
}
288289
}
289290
}
290-
#endif
291+
#endif // !HAVE_APPLE
292+
#endif // HAVE_MSC
291293

292294
return file_descriptor;
293295
}

0 commit comments

Comments
 (0)