Skip to content

Commit

Permalink
Merge pull request #12 from pspdev/allegrex-v4.4.0-fixLockAPI
Browse files Browse the repository at this point in the history
Fix scandir DD_LOCK
  • Loading branch information
wally4000 authored May 16, 2024
2 parents 579341c + bacbe47 commit 3577f9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions newlib/libc/posix/scandir.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ scandir(const char *dirname, struct dirent ***namelist,
}
names[numitems++] = p;
}
#ifdef HAVE_DD_LOCK
__lock_release_recursive(dirp->dd_lock);
#endif
closedir(dirp);
if (numitems && dcomp != NULL)
qsort(names, numitems, sizeof(struct dirent *), (void *)dcomp);
*namelist = names;
#ifdef HAVE_DD_LOCK
__lock_release_recursive(dirp->dd_lock);
#endif
return (numitems);

fail:
while (numitems > 0)
free(names[--numitems]);
free(names);
closedir(dirp);
#ifdef HAVE_DD_LOCK
__lock_release_recursive(dirp->dd_lock);
#endif
closedir(dirp);
return (-1);
}

Expand Down

0 comments on commit 3577f9d

Please sign in to comment.