readlink失败返回原字符串

This commit is contained in:
gb 2023-02-03 12:00:50 +08:00
parent 594901065c
commit 2c0bc48e20
1 changed files with 1 additions and 1 deletions

View File

@ -297,7 +297,7 @@ extern "C"
char path[256] = { 0 };
int len = readlink(lnk, path, sizeof(path) - 1);
return path;
return len > 0 ? path : lnk;
}
static int enum_files(const char* dir, bool recursive, bool(*found_file)(const char* path_file, void* param), void* param)
{