mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 11:43:50 +00:00
+2
-4
@@ -61,15 +61,13 @@ int protect_socket(int fd) {
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
|
||||
const char path[] = "#shadowsocks_protect";
|
||||
const char path[] = "/data/data/com.github.shadowsocks/protect_path";
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path)-1);
|
||||
addr.sun_path[0] = 0;
|
||||
socklen_t len = strlen(path) + offsetof(struct sockaddr_un, sun_path);
|
||||
|
||||
if (connect(sock, (struct sockaddr*)&addr, len) == -1) {
|
||||
if (connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
|
||||
LOGE("[android] connect() failed: %s (socket fd = %d)\n", strerror(errno), sock);
|
||||
close(sock);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user