e1cap_dump: fix superchannel without pcap output

We have to check if g_pcap_fd is >= 0,as we initialize it to -1.

Change-Id: I458c02b4619b6fb2c7d30b1ce3bbac86243a6977
This commit is contained in:
Harald Welte 2019-11-24 18:54:02 +01:00
parent 645fa46967
commit 3863beef26
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ static int all_bytes_are(unsigned char ch, const uint8_t *data, int len)
static void handle_hdlc_frame_content(const uint8_t *data, unsigned int len,
void *priv)
{
if (g_pcap_fd && len >= 4) {
if (g_pcap_fd >= 0 && len >= 4) {
uint8_t *cur = msgb_put(g_pcap_msg, len-2);
memcpy(cur, data, len-2);
printf("==> %s\n", msgb_hexdump(g_pcap_msg));