static int packet_show(struct filter *f)
{
FILE *fp;
+ int rc = 0;
if (!filter_af_get(f, AF_PACKET) || !(f->states & (1 << SS_CLOSE)))
return 0;
if ((fp = net_packet_open()) == NULL)
return -1;
if (generic_record_read(fp, packet_show_line, f, AF_PACKET))
- return -1;
+ rc = -1;
- return 0;
+ fclose(fp);
+ return rc;
}
static int netlink_show_one(struct filter *f,
netlink_show_one(f, prot, pid, groups, 0, 0, 0, rq, wq, sk, cb);
}
+ fclose(fp);
return 0;
}