androiddump.c: Use preprocessor directive to distinguish E_AGAIN and E_WOULDBLOCK.
VS Code analysis considers them hardcoded values so the if statement is either always true or always false. Change-Id: Iad04add9391c515873e2e00d2c6cbd682fbf5b3f Reviewed-on: https://code.wireshark.org/review/16419 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
2c0d11716b
commit
ed27ad491d
|
@ -1159,7 +1159,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
|
||||
errno = 0;
|
||||
length = recv(sock, data + used_buffer_length, (int)(PACKET_LENGTH - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -1231,7 +1237,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
|
||||
errno = 0;
|
||||
length = recv(sock, data + used_buffer_length, (int)(PACKET_LENGTH - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -1267,7 +1279,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
while (endless_loop) {
|
||||
errno = 0;
|
||||
length = recv(sock, data + used_buffer_length, (int)(PACKET_LENGTH - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -1581,7 +1599,13 @@ static int capture_android_bluetooth_external_parser(char *interface,
|
|||
while (endless_loop) {
|
||||
errno = 0;
|
||||
length = recv(sock, buffer + used_buffer_length, (int)(PACKET_LENGTH - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -1802,7 +1826,13 @@ static int capture_android_bluetooth_btsnoop_net(char *interface, char *fifo,
|
|||
errno = 0;
|
||||
length = recv(sock, packet + used_buffer_length + sizeof(own_pcap_bluetooth_h4_header),
|
||||
(int)(PACKET_LENGTH - sizeof(own_pcap_bluetooth_h4_header) - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -1979,7 +2009,13 @@ static int capture_android_logcat_text(char *interface, char *fifo,
|
|||
while (endless_loop) {
|
||||
errno = 0;
|
||||
length = recv(sock, packet + exported_pdu_headers_size + used_buffer_length, (int)(PACKET_LENGTH - exported_pdu_headers_size - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -2159,7 +2195,13 @@ static int capture_android_logcat(char *interface, char *fifo,
|
|||
while (endless_loop) {
|
||||
errno = 0;
|
||||
length = recv(sock, packet + exported_pdu_headers_size + used_buffer_length, (int)(PACKET_LENGTH - exported_pdu_headers_size - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) continue;
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
closesocket(sock);
|
||||
|
@ -2331,8 +2373,13 @@ static int capture_android_wifi_tcpdump(char *interface, char *fifo,
|
|||
char *i_position;
|
||||
errno = 0;
|
||||
length = recv(sock, data + used_buffer_length, (int)(PACKET_LENGTH - used_buffer_length), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK))
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
errmsg_print("ERROR capture: %s", strerror(errno));
|
||||
return EXIT_CODE_GENERIC;
|
||||
|
@ -2449,7 +2496,11 @@ static int capture_android_wifi_tcpdump(char *interface, char *fifo,
|
|||
while (endless_loop) {
|
||||
errno = 0;
|
||||
length = recv(sock, data + used_buffer_length, (int)(PACKET_LENGTH -(used_buffer_length + filter_buffer_length)), 0);
|
||||
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK)) {
|
||||
if (errno == EAGAIN
|
||||
#if EWOULDBLOCK != EAGAIN
|
||||
|| errno == EWOULDBLOCK
|
||||
#endif
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
else if (errno != 0) {
|
||||
|
|
Loading…
Reference in New Issue