diff options
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r-- | netsniff-ng.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c index dfab81a..d6782ac 100644 --- a/netsniff-ng.c +++ b/netsniff-ng.c @@ -570,7 +570,12 @@ static void read_pcap(struct ctx *ctx) if (ctx->pcap == PCAP_OPS_MM) ctx->pcap = PCAP_OPS_SG; } else { - fd = open_or_die(ctx->device_in, O_RDONLY | O_LARGEFILE | O_NOATIME); + fd = open(ctx->device_in, O_RDONLY | O_LARGEFILE | O_NOATIME); + if (fd < 0 && errno == EPERM) + fd = open_or_die(ctx->device_in, O_RDONLY | O_LARGEFILE); + if (fd < 0) + panic("Cannot open file %s! %s.\n", ctx->device_in, + strerror(errno)); } if (__pcap_io->init_once_pcap) |