This commit is contained in:
Max Lv
2016-01-24 17:18:09 +08:00
parent dbe1e01074
commit 0d64f11f47
3 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -72,7 +72,8 @@ int protect_socket(int fd)
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
LOGE("[android] connect() failed: %s (socket fd = %d)\n", strerror(errno), sock);
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
strerror(errno), sock, path);
close(sock);
return -1;
}
@@ -113,14 +114,15 @@ int send_traffic_stat(uint64_t tx, uint64_t rx)
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
char path[256];
sprintf(path, "%s/protect_path", prefix);
sprintf(path, "%s/stat_path", prefix);
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
LOGE("[android] connect() failed: %s (socket fd = %d)\n", strerror(errno), sock);
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
strerror(errno), sock, path);
close(sock);
return -1;
}