summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/inetcat.c3
-rw-r--r--tools/iproxy.c40
2 files changed, 22 insertions, 21 deletions
diff --git a/tools/inetcat.c b/tools/inetcat.c
index 1674c81..59c18b2 100644
--- a/tools/inetcat.c
+++ b/tools/inetcat.c
@@ -197,7 +197,8 @@ int main(int argc, char **argv)
if (dev_list[i].conn_type == CONNECTION_TYPE_USB && (lookup_opts & DEVICE_LOOKUP_USBMUX)) {
dev = &(dev_list[i]);
break;
- } else if (dev_list[i].conn_type == CONNECTION_TYPE_NETWORK && (lookup_opts & DEVICE_LOOKUP_NETWORK)) {
+ }
+ if (dev_list[i].conn_type == CONNECTION_TYPE_NETWORK && (lookup_opts & DEVICE_LOOKUP_NETWORK)) {
dev = &(dev_list[i]);
break;
}
diff --git a/tools/iproxy.c b/tools/iproxy.c
index 28fcb46..5dca580 100644
--- a/tools/iproxy.c
+++ b/tools/iproxy.c
@@ -112,7 +112,8 @@ static void *acceptor_thread(void *arg)
if (dev_list[i].conn_type == CONNECTION_TYPE_USB && (cdata->lookup_opts & DEVICE_LOOKUP_USBMUX)) {
dev = &(dev_list[i]);
break;
- } else if (dev_list[i].conn_type == CONNECTION_TYPE_NETWORK && (cdata->lookup_opts & DEVICE_LOOKUP_NETWORK)) {
+ }
+ if (dev_list[i].conn_type == CONNECTION_TYPE_NETWORK && (cdata->lookup_opts & DEVICE_LOOKUP_NETWORK)) {
dev = &(dev_list[i]);
break;
}
@@ -459,28 +460,27 @@ int main(int argc, char **argv)
if (c_sock < 0) {
fprintf(stderr, "accept: %s\n", strerror(errno));
break;
- } else {
- printf("New connection for %d->%d, fd = %d\n", listen_port[listen_sock[i].index], device_port[listen_sock[i].index], c_sock);
- cdata = (struct client_data*)malloc(sizeof(struct client_data));
- if (!cdata) {
- socket_close(c_sock);
- fprintf(stderr, "ERROR: Out of memory\n");
- free(device_udid);
- return -1;
- }
- cdata->fd = c_sock;
- cdata->sfd = -1;
- cdata->udid = (device_udid) ? strdup(device_udid) : NULL;
- cdata->lookup_opts = lookup_opts;
- cdata->device_port = device_port[listen_sock[i].index];
+ }
+ printf("New connection for %d->%d, fd = %d\n", listen_port[listen_sock[i].index], device_port[listen_sock[i].index], c_sock);
+ cdata = (struct client_data*)malloc(sizeof(struct client_data));
+ if (!cdata) {
+ socket_close(c_sock);
+ fprintf(stderr, "ERROR: Out of memory\n");
+ free(device_udid);
+ return -1;
+ }
+ cdata->fd = c_sock;
+ cdata->sfd = -1;
+ cdata->udid = (device_udid) ? strdup(device_udid) : NULL;
+ cdata->lookup_opts = lookup_opts;
+ cdata->device_port = device_port[listen_sock[i].index];
#ifdef WIN32
- acceptor = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)acceptor_thread, cdata, 0, NULL);
- CloseHandle(acceptor);
+ acceptor = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)acceptor_thread, cdata, 0, NULL);
+ CloseHandle(acceptor);
#else
- pthread_create(&acceptor, NULL, acceptor_thread, cdata);
- pthread_detach(acceptor);
+ pthread_create(&acceptor, NULL, acceptor_thread, cdata);
+ pthread_detach(acceptor);
#endif
- }
}
}
}