fix(native): a trailing slash after a program keeps the hook's exe name like the kernel (#3171)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-24 18:24:41 -05:00
1 parent 5ed97915c7
commit 9be131cf6d
2 files changed
+7 -2

No files matched your search

+1 -2
View File
@@ -54,12 +54,11 @@ static void resolve_symlinks(const char *path, char *out, size_t out_size, int d
if (used >= sizeof(done) - 1) return;
if (!follow_link(done, link_target, sizeof(link_target))) {
struct stat st;
if (rest[strspn(rest, "/")] && (syscall(SYS_newfstatat, AT_FDCWD, done, &st, 0) != 0 || !S_ISDIR(st.st_mode))) return;
if (*rest && (syscall(SYS_newfstatat, AT_FDCWD, done, &st, 0) != 0 || !S_ISDIR(st.st_mode))) return;
continue;
}
if (++links > 40) return;
size_t m = ddnatv_append(next_path, sizeof(next_path), 0, link_target, strlen(link_target));
m = ddnatv_append(next_path, sizeof(next_path), m, "/", 1);
m = ddnatv_append(next_path, sizeof(next_path), m, rest, strlen(rest));
if (m >= sizeof(next_path) - 1) return;
if (link_target[0] == '/') {