summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-11-11 21:17:57 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-11-11 21:17:57 +0100
commita4d7f34d0210344d2e25e5af1c2e61057422521d (patch)
treeec7dcec92fcee2bce373ce5bcc5c4be3704c3b4a
parent21cddfba5f53ed0ad9d8f14bc1555c57cad9790e (diff)
Revert "inotail.c: Decrement n_units before calling tail_pipe_from_begin"pipe
This reverts commit 21cddfba5f53ed0ad9d8f14bc1555c57cad9790e. Makes inotail -n +0 work again. Sometimes reducing code leads to unrecognised errors ;-)
-rw-r--r--inotail.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/inotail.c b/inotail.c
index 2eef622..483306e 100644
--- a/inotail.c
+++ b/inotail.c
@@ -244,6 +244,9 @@ 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))
@@ -292,7 +295,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 - 1, M_LINES);
+ return tail_pipe_from_begin(f, n_lines, M_LINES);
if (n_lines == 0)
return 0;
@@ -400,7 +403,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 - 1, M_BYTES);
+ return tail_pipe_from_begin(f, n_bytes, M_BYTES);
/* XXX: Needed? */
if (n_bytes == 0)
td> 2014-02-13ACPI / fan: fix fan driver compile error when CONFIG_PM_SLEEP is undefinedShuah Khan1-0/+3 2013-12-07ACPI: Clean up inclusions of ACPI header filesLv Zheng1-2/+1 2013-09-24ACP / fan: trivial style cleanupFelipe Contreras1-1/+1 2013-07-30ACPI / PM: Use ACPI_STATE_D3_COLD instead of ACPI_STATE_D3 everywhereRafael J. Wysocki1-2/+2 2013-07-04ACPI / fan: Initialize acpi_state variableNaresh Bhat1-1/+1 2013-03-25ACPI / fan: avoid null pointer deference errorColin Ian King1-2/+6 2013-01-26ACPI: Remove useless type argument of driver .remove() operationRafael J. Wysocki1-2/+2 2012-09-21ACPI/fan: convert to module_acpi_driver()Mika Westerberg1-21/+1 2012-08-10ACPI / PM: Fix unused function warnings for CONFIG_PM_SLEEPRafael J. Wysocki1-0/+4 2012-07-01ACPI: Use struct dev_pm_ops for power management in the fan driverRafael J. Wysocki1-10/+11 2012-07-01ACPI / PM: Drop pm_message_t argument from device suspend callbackRafael J. Wysocki1-2/+2 2011-07-16ACPI: constify ops structsVasiliy Kulikov1-1/+1 2011-01-12ACPI / Fan: Rework the handling of power resourcesRafael J. Wysocki1-20/+7 2010-10-15ACPI fan: remove deprecated procfs I/FZhang Rui1-138/+1 2010-09-29ACPI: fan: Fix more unbalanced code blockLuis Henriques1-0/+2 2010-06-10ACPI: fan: fix unbalanced code blockLiang Li1-1/+2