From b65101beb4db64847d9bd2b770fe55521b97c8ed Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 16 Apr 2007 11:04:49 +0200 Subject: inotail.c: Really fix byte_to_offset() this time Also make a bit more readable --- inotail.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/inotail.c b/inotail.c index 0c278e2..6f8be7c 100644 --- a/inotail.c +++ b/inotail.c @@ -198,12 +198,18 @@ static off_t lines_to_offset(struct file_struct *f, unsigned long n_lines) static off_t bytes_to_offset(struct file_struct *f, unsigned long n_bytes) { - /* tail everything for 'inotail -c +0' or if n_bytes greater than the - * total amount of chars in the file */ - if ((from_begin && n_bytes == 0) || ((off_t) n_bytes > f->st_size)) - return 0; - else - return (from_begin ? ((off_t) n_bytes - 1) : (f->st_size - (off_t) n_bytes)); + off_t offset = 0; + + /* tail everything for 'inotail -c +0' */ + if (from_begin) { + if (n_bytes > 0) + offset = (off_t) n_bytes - 1; + } else { + if ((off_t) n_bytes < f->st_size) + offset = f->st_size - (off_t) n_bytes; + } + + return offset; } static ssize_t tail_pipe(struct file_struct *f) -- cgit v1.2.3-54-g00ecf er net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2017-02-02 08:52:21 -0800
committerDavid S. Miller <davem@davemloft.net>2017-02-03 16:01:44 -0500
commit94b5e0f970258828bf163b5ef076da4e4b0802e0 (patch)
treeb0fcd7892b00ecdccdc4328a632d98e74d6f265f /net
parent3898fac1f488c76e0eef5b5267b4ba8112a82ac4 (diff)
net: ipv6: Set protocol to kernel for local routes
IPv6 stack does not set the protocol for local routes, so those routes show up with proto "none": $ ip -6 ro ls table local local ::1 dev lo proto none metric 0 pref medium local 2100:3:: dev lo proto none metric 0 pref medium local 2100:3::4 dev lo proto none metric 0 pref medium local fe80:: dev lo proto none metric 0 pref medium ... Set rt6i_protocol to RTPROT_KERNEL for consistency with IPv4. Now routes show up with proto "kernel": $ ip -6 ro ls table local local ::1 dev lo proto kernel metric 0 pref medium local 2100:3:: dev lo proto kernel metric 0 pref medium local 2100:3::4 dev lo proto kernel metric 0 pref medium local fe80:: dev lo proto kernel metric 0 pref medium ... Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/route.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c