summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-09-25 23:51:29 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-09-25 23:51:29 +0200
commit21cddfba5f53ed0ad9d8f14bc1555c57cad9790e (patch)
treece353a7ff7d7401a82969b8f7e086582b38b8f50 /inotail.c
parent6ec61a62e5a1a586766d46108d5ae7e1aaf3dd8c (diff)
inotail.c: Decrement n_units before calling tail_pipe_from_begin
Saves 2 lines of code
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/inotail.c b/inotail.c
index 483306e..2eef622 100644
--- a/inotail.c
+++ b/inotail.c
@@ -244,9 +244,6 @@ static int tail_pipe_from_begin(struct file_struct *f, unsigned long n_units, co
int bytes_read = 0;
char buf[BUFSIZ];
- if (n_units)
- n_units--;
-
while (n_units > 0) {
if ((bytes_read = read(f->fd, buf, BUFSIZ)) <= 0) {
if (bytes_read < 0 && (errno == EINTR || errno == EAGAIN))
@@ -295,7 +292,7 @@ static int tail_pipe_lines(struct file_struct *f, unsigned long n_lines)
const char *p;
if (from_begin)
- return tail_pipe_from_begin(f, n_lines, M_LINES);
+ return tail_pipe_from_begin(f, n_lines - 1, M_LINES);
if (n_lines == 0)
return 0;
@@ -403,7 +400,7 @@ static int tail_pipe_bytes(struct file_struct *f, unsigned long n_bytes)
unsigned long i = 0; /* Index into buffer */
if (from_begin)
- return tail_pipe_from_begin(f, n_bytes, M_BYTES);
+ return tail_pipe_from_begin(f, n_bytes - 1, M_BYTES);
/* XXX: Needed? */
if (n_bytes == 0)
/td>arm64: atomics: prefetch the destination word for write prior to stxrWill Deacon1-0/+2 2015-07-27arm64: bitops: patch in lse instructions when supported by the CPUWill Deacon1-19/+24 2015-07-27arm64: introduce CONFIG_ARM64_LSE_ATOMICS as fallback to ll/sc atomicsWill Deacon2-0/+16 2015-07-27arm64: kernel: Add support for Privileged Access NeverJames Morse4-0/+32 2015-07-27arm64: lib: use pair accessors for copy_*_user routinesWill Deacon3-18/+33 2014-11-13arm64: __clear_user: handle exceptions on strbKyle McMartin1-1/+1 2014-05-23arm64: lib: Implement optimized string length routineszhichang.yuan3-1/+299 2014-05-23arm64: lib: Implement optimized string compare routineszhichang.yuan3-1/+545 2014-05-23arm64: lib: Implement optimized memcmp routinezhichang.yuan2-1/+259 2014-05-23arm64: lib: Implement optimized memset routinezhichang.yuan1-22/+185 2014-05-23arm64: lib: Implement optimized memmove routinezhichang.yuan1-25/+165 2014-05-23arm64: lib: Implement optimized memcpy routinezhichang.yuan1-22/+170 2014-02-07arm64: atomics: fix use of acquire + release for full barrier semanticsWill Deacon1-1/+2 2013-12-19arm64: use generic strnlen_user and strncpy_from_user functionsWill Deacon3-102/+3 2013-05-08arm64: Treat the bitops index argument as an 'int'Catalin Marinas1-5/+5 2013-04-30arm64: Use acquire/release semantics instead of explicit DMBCatalin Marinas1-4/+2 2013-04-30arm64: klib: bitops: fix unpredictable stxr usageMark Rutland1-2/+2 2013-03-21arm64: klib: Optimised atomic bitopsCatalin Marinas2-25/+70 2013-03-21arm64: klib: Optimised string functionsCatalin Marinas3-1/+87 2013-03-21arm64: klib: Optimised memory functionsCatalin Marinas5-1/+209 2012-09-17arm64: Miscellaneous library functionsMarc Zyngier5-0/+169 2012-09-17arm64: User access library functionsCatalin Marinas6-0/+345