On 05/06/2015 07:36 PM, Vadim Kochan wrote:
From: Vadim Kochan <vadi...@gmail.com>

It fixes the case when user made pcap file in sudo
mode but after it should still use sudo to read it
because of setting O_NOATIME option requires higher
privileges.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
  netsniff-ng.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netsniff-ng.c b/netsniff-ng.c
index dfab81a..d426af6 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -570,7 +570,7 @@ 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_or_die(ctx->device_in, O_RDONLY | O_LARGEFILE);

Okay, I see, thanks for looking into this, Vadim!

Could you rather make the test optional? I.e. if normal open(2) with O_NOATIME
fails due to bad permissions, fall back to open_or_die(ctx->device_in, O_RDONLY 
|
O_LARGEFILE). I think that would be better.

Thanks,
Daniel

--
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to