mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(native): remove, glob and nftw take guest paths, and links in a mount are followed as the guest sees them
This commit is contained in:
1 parent
89dd9fa161
commit
d9c694858c
7 files changed
+269
-25
No files matched your search
@@ -132,7 +132,14 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
|
||||
struct sockaddr_un mod_sun;
|
||||
memset(&mod_sun, 0, sizeof(mod_sun));
|
||||
mod_sun.sun_family = AF_UNIX;
|
||||
rewrite_unix_socket_path(sun->sun_path, mod_sun.sun_path, sizeof(mod_sun.sun_path));
|
||||
char guest[sizeof(sun->sun_path) + 1];
|
||||
size_t max = addrlen - offsetof(struct sockaddr_un, sun_path);
|
||||
if (max > sizeof(sun->sun_path)) max = sizeof(sun->sun_path);
|
||||
memcpy(guest, sun->sun_path, max);
|
||||
guest[max] = '\0';
|
||||
char followed[PATH_MAX];
|
||||
const char *path = guest[0] == '/' ? follow_guest_link(guest, followed, sizeof(followed)) : guest;
|
||||
rewrite_unix_socket_path(path, mod_sun.sun_path, sizeof(mod_sun.sun_path));
|
||||
return orig_connect ? orig_connect(sockfd, (struct sockaddr *)&mod_sun, sizeof(mod_sun)) : -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user