summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2015-05-07 13:32:59 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2015-05-07 13:32:59 +0200
commitd9432291168e7e15877bdd4c1c23ed0dc8913246 (patch)
tree745641f1ffb472aeee59b05a660306a6b82b1422 /netsniff-ng.c
parentf6d211974eff4ba67461262031af54fdb4f54210 (diff)
netsniff-ng: add comment wrt NOATIME and fix whitespace
Just add a comment to the reader, so that it's obvious. The second condition could have been spared in case of open_or_die(), but it's nothing critical and the extra indent can be spared instead. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index d6782ac..afa522f 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -570,12 +570,16 @@ static void read_pcap(struct ctx *ctx)
if (ctx->pcap == PCAP_OPS_MM)
ctx->pcap = PCAP_OPS_SG;
} else {
+ /* O_NOATIME requires privileges, in case we don't have
+ * them, retry without them at a minor cost of updating
+ * atime in case the fs has been mounted as such.
+ */
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));
+ strerror(errno));
}
if (__pcap_io->init_once_pcap)