Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ABI wrapping for readdir() #3640

Merged
merged 3 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ int __abi_wrap_readdir_r(DIR* dirp,
SB_CHECK(musl_entry);
SB_CHECK(musl_result);

struct dirent entry; // The type from platform toolchain.
struct dirent* result;
struct dirent entry = {0}; // The type from platform toolchain.
struct dirent* result = nullptr;
int retval = readdir_r(dirp, &entry, &result);
if (retval != 0) {
return retval;
Expand All @@ -40,8 +40,8 @@ int __abi_wrap_readdir_r(DIR* dirp,
constexpr auto minlen =
std::min(sizeof(musl_entry->d_name), sizeof(entry.d_name));
memcpy(musl_entry->d_name, entry.d_name, minlen);
if (result == NULL) {
*musl_result = NULL;
if (result == nullptr) {
*musl_result = nullptr;
} else {
*musl_result = musl_entry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {
#endif

typedef struct musl_dirent {
ino_t d_ino;
int64_t /* ino_t */ d_ino;
kaidokert marked this conversation as resolved.
Show resolved Hide resolved
int64_t /* off_t */ d_off;
uint16_t /* short */ d_reclen;
unsigned char d_type;
Expand Down
Loading