bt-linux, bt-monitor-linux: use PCAP_ERROR_ codes.
Use them rather than numerical values.
(cherry picked from commit 844f9d7ddff47c58f27b76c1620f38345ba73627)
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index 73548bd..e847c02 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -86,7 +86,7 @@
return 0;
pcapint_fmt_errmsg_for_errno(err_str, PCAP_ERRBUF_SIZE,
errno, "Can't open raw Bluetooth socket");
- return -1;
+ return PCAP_ERROR;
}
dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
@@ -94,7 +94,7 @@
{
snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
- ret = -1;
+ ret = PCAP_ERROR;
goto done;
}
@@ -112,7 +112,7 @@
{
pcapint_fmt_errmsg_for_errno(err_str, PCAP_ERRBUF_SIZE,
errno, "Can't get Bluetooth device list via ioctl");
- ret = -1;
+ ret = PCAP_ERROR;
goto free;
}
@@ -133,7 +133,7 @@
*/
if (pcapint_add_dev(devlistp, dev_name, PCAP_IF_WIRELESS, dev_descr, err_str) == NULL)
{
- ret = -1;
+ ret = PCAP_ERROR;
break;
}
}
@@ -343,7 +343,7 @@
if (handle->break_loop)
{
handle->break_loop = 0;
- return -2;
+ return PCAP_ERROR_BREAK;
}
ret = recvmsg(handle->fd, &msg, 0);
} while ((ret == -1) && (errno == EINTR));
@@ -355,7 +355,7 @@
}
pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
errno, "Can't receive packet");
- return -1;
+ return PCAP_ERROR;
}
pkth.caplen = (bpf_u_int32)ret;
diff --git a/pcap-bt-monitor-linux.c b/pcap-bt-monitor-linux.c
index 9abd97b..e411587 100644
--- a/pcap-bt-monitor-linux.c
+++ b/pcap-bt-monitor-linux.c
@@ -84,7 +84,7 @@
PCAP_IF_WIRELESS|PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE,
"Bluetooth Linux Monitor", err_str) == NULL)
{
- ret = -1;
+ ret = PCAP_ERROR;
}
return ret;
@@ -121,7 +121,7 @@
if (handle->break_loop)
{
handle->break_loop = 0;
- return -2;
+ return PCAP_ERROR_BREAK;
}
ret = recvmsg(handle->fd, &msg, 0);
} while ((ret == -1) && (errno == EINTR));
@@ -133,7 +133,7 @@
}
pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
errno, "Can't receive packet");
- return -1;
+ return PCAP_ERROR;
}
pkth.caplen = (bpf_u_int32)(ret - sizeof(hdr) + sizeof(pcap_bluetooth_linux_monitor_header));
@@ -163,7 +163,7 @@
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Packet injection is not supported yet on Bluetooth monitor devices");
- return -1;
+ return PCAP_ERROR;
}
static int