summaryrefslogtreecommitdiff
path: root/extcap/androiddump.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-08-07 19:09:17 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-08-09 10:19:57 +0000
commitb669ca75c435d741920110a5d5e7822f55f899b0 (patch)
tree77992a0a5cc7abdfef404f9d471481597702bd5c /extcap/androiddump.c
parent7596268b9b34e24404e358f73190829e366add3b (diff)
downloadwireshark-b669ca75c435d741920110a5d5e7822f55f899b0.tar.gz
androiddump: fix bug in socket retry (CID 1293391).
Change-Id: I61914d208e984d202506cdc885493e841e929990 Reviewed-on: https://code.wireshark.org/review/16948 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'extcap/androiddump.c')
-rw-r--r--extcap/androiddump.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index e8e4287af9..a139b86162 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -1060,7 +1060,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
static char helpful_packet[PACKET_LENGTH];
gssize length;
gssize used_buffer_length = 0;
- socket_handle_t sock;
+ socket_handle_t sock = INVALID_SOCKET;
const char *adb_transport = "0012""host:transport-any";
const char *adb_transport_serial_templace = "%04x""host:transport:%s";
const char *adb_shell_hcidump = "0013""shell:hcidump -R -t";
@@ -1079,7 +1079,6 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
int ms = 0;
struct tm date;
char direction_character;
- int try_next = 0;
SET_DATA(h4_header, value_own_pcap_bluetooth_h4_header, packet);
@@ -1166,7 +1165,8 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
if (!strncmp(state_line_position, "Can't access device: Permission denied", 38)) {
g_warning("No permission for command <%s>", adb_shell_hcidump);
used_buffer_length = 0;
- try_next += 1;
+ closesocket(sock);
+ sock = INVALID_SOCKET;
break;
}
memmove(data, i_position, used_buffer_length - (i_position - data));
@@ -1176,7 +1176,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
}
}
- if (try_next == 1) {
+ if (sock == INVALID_SOCKET) {
sock = adb_connect(adb_server_ip, adb_server_tcp_port);
if (sock == INVALID_SOCKET)
return EXIT_CODE_INVALID_SOCKET_4;