<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/4b0c903e1fb012f5dd9190169277539e90b97542">https://github.com/macports/macports-legacy-support/commit/4b0c903e1fb012f5dd9190169277539e90b97542</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 4b0c903e1fb012f5dd9190169277539e90b97542
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Fri Feb 16 14:12:51 2024 -0800
<span style='display:block; white-space:pre;color:#404040;'> fdopendir: Clean up and fix OS version check
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This defines the 10.5+ __dd_fd as a macro for the 10.4 dd_fd, thereby
</span><span style='display:block; white-space:pre;color:#404040;'> aviding the need for a conditional in the body of the code.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Also, exact equality comparisons for ..._MIN_REQUIRED__ are
</span><span style='display:block; white-space:pre;color:#404040;'> inappropriate. In particular, in 10.4,
</span><span style='display:block; white-space:pre;color:#404040;'> __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ may not be defined at
</span><span style='display:block; white-space:pre;color:#404040;'> all, though the assumed default value of 0 has the right effect on
</span><span style='display:block; white-space:pre;color:#404040;'> inequality comparisons. Also, it's best to use "< <next os>" rather
</span><span style='display:block; white-space:pre;color:#404040;'> than "<= <this os>", to allow for multiple values of the low-order
</span><span style='display:block; white-space:pre;color:#404040;'> digit.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> Still works for all OS versions.
</span><span style='display:block; white-space:pre;color:#404040;'> Tested on 10.4-10.5 ppc, 10.4-10.6 i386, 10.4-12.x x86_64, 11.x-14.x
</span><span style='display:block; white-space:pre;color:#404040;'> arm64.
</span>---
src/fdopendir.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/fdopendir.c b/src/fdopendir.c
</span><span style='display:block; white-space:pre;color:#808080;'>index 0b8c815..8c4e62c 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/fdopendir.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/fdopendir.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -24,6 +24,10 @@
</span>
#include <dirent.h>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __dd_fd dd_fd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /*
* Implementation behavior largely follows these man page descriptions:
*
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -51,13 +55,8 @@ DIR *fdopendir(int dirfd) {
</span> * A subsequent closedir() will close dirfd
*/
<span style='display:block; white-space:pre;background:#ffe0e0;'>- #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ == 1040
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- (void)close(dir->dd_fd);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- dir->dd_fd = dirfd;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span> (void)close(dir->__dd_fd);
dir->__dd_fd = dirfd;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span>
/*
* Rewind to the start of the directory, in case the underlying file
</pre><pre style='margin:0'>
</pre>