summaryrefslogtreecommitdiff
path: root/extcap/androiddump.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-07-13 18:18:03 -0400
committerAnders Broman <a.broman58@gmail.com>2016-07-14 07:05:50 +0000
commited27ad491dda85c96d3cbe78c54eff7adf67548f (patch)
treefe803f21286b212bf68d7c7c8f633e3b97a03470 /extcap/androiddump.c
parent2c0d11716bac5807e35d97686c6d7d9293d2795e (diff)
downloadwireshark-ed27ad491dda85c96d3cbe78c54eff7adf67548f.tar.gz
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>
Diffstat (limited to 'extcap/androiddump.c')
-rw-r--r--extcap/androiddump.c69
1 files changed, 60 insertions, 9 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index e03d93495e..07a2f77ad8 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -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) {