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;
}
+1 -1
View File
@@ -995,7 +995,7 @@ int main(int argc, char **argv)
USE_TTY();
#ifdef ANDROID
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:uvVAP",
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:P:uvVA",
long_options, &option_index)) != -1) {
#else
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:uvA",
+1 -1
View File
@@ -701,7 +701,7 @@ int main(int argc, char **argv)
USE_TTY();
#ifdef ANDROID
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:uUvVAP")) != -1) {
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:P:uUvVA")) != -1) {
#else
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:uUvA")) != -1) {
#endif