mirror of
https://github.com/boostorg/filesystem.git
synced 2026-01-19 04:12:09 +00:00
Added a workaround for dirfd being a macro on FreeBSD 9 and older.
Fixes https://github.com/boostorg/filesystem/issues/328.
This commit is contained in:
@@ -16,6 +16,7 @@ int main()
|
||||
{
|
||||
int fd = open(".", O_DIRECTORY | O_RDONLY | O_NOFOLLOW);
|
||||
DIR* dir = fdopendir(fd);
|
||||
// Note: dirfd is a macro on FreeBSD 9 and older
|
||||
int internal_fd = dirfd(dir);
|
||||
return dir != 0 && internal_fd >= 0;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
<li>On Windows, <code>canonical</code> is now based on the <code>GetFinalPathNameByHandleW</code> WinAPI function. As a side effect, drive letters are converted to upper case, which makes the resulting paths more interoperable. (<a href="https://github.com/boostorg/filesystem/issues/325">#325</a>)</li>
|
||||
<li><b>v4:</b> <code>canonical</code> no longer produces a trailing directory separator in the resulting path, if the input path has one.</li>
|
||||
<li>If a <code>path</code> constructor or member function is called with an argument of a user-defined type that is convertible to <code>path</code> and one or more <a href="reference.html#Source"><code>Source</code></a> types, the conversion to <code>path</code> is now chosen by default. This may resolve argument conversion ambiguities in some cases, but may also result in a less optimal conversion path. If a different conversion path is desired, users are recommended to use explicit type casts. (<a href="https://github.com/boostorg/filesystem/issues/326">#326</a>)</li>
|
||||
<li>Added a workaround for <code>dirfd</code> being a macro on FreeBSD 9 and older. (<a href="https://github.com/boostorg/filesystem/issues/328">#328</a>)</li>
|
||||
</ul>
|
||||
|
||||
<h2>1.86.0</h2>
|
||||
|
||||
@@ -270,7 +270,8 @@ inline system::error_code dir_itr_close(dir_itr_imp& imp) noexcept
|
||||
// Obtains a file descriptor from the directory iterator
|
||||
inline int dir_itr_fd(dir_itr_imp const& imp, system::error_code& ec)
|
||||
{
|
||||
int fd = ::dirfd(static_cast< DIR* >(imp.handle));
|
||||
// Note: dirfd is a macro on FreeBSD 9 and older
|
||||
const int fd = dirfd(static_cast< DIR* >(imp.handle));
|
||||
if (BOOST_UNLIKELY(fd < 0))
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
Reference in New Issue
Block a user