mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-06 18:03:32 +00:00
stop readdir parsing crashing
This commit is contained in:
parent
327fb51cec
commit
7d1983ebc2
@ -482,9 +482,14 @@ int git_path_cmp(
|
|||||||
/* Taken from git.git */
|
/* Taken from git.git */
|
||||||
GIT_INLINE(int) is_dot_or_dotdot(const char *name)
|
GIT_INLINE(int) is_dot_or_dotdot(const char *name)
|
||||||
{
|
{
|
||||||
|
#ifdef __amigaos4__
|
||||||
|
/* This is irrelevant on AmigaOS */
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return (name[0] == '.' &&
|
return (name[0] == '.' &&
|
||||||
(name[1] == '\0' ||
|
(name[1] == '\0' ||
|
||||||
(name[1] == '.' && name[2] == '\0')));
|
(name[1] == '.' && name[2] == '\0')));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_path_direach(
|
int git_path_direach(
|
||||||
@ -512,7 +517,11 @@ int git_path_direach(
|
|||||||
de_buf = git__malloc(sizeof(struct dirent));
|
de_buf = git__malloc(sizeof(struct dirent));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __amigaos4__
|
||||||
|
while (de = readdir(dir)) {
|
||||||
|
#else
|
||||||
while (p_readdir_r(dir, de_buf, de) == 0 && de != NULL) {
|
while (p_readdir_r(dir, de_buf, de) == 0 && de != NULL) {
|
||||||
|
#endif
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (is_dot_or_dotdot(de->d_name))
|
if (is_dot_or_dotdot(de->d_name))
|
||||||
|
Loading…
Reference in New Issue
Block a user