[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail -f: --pid *and* inotify
From: |
Pádraig Brady |
Subject: |
Re: tail -f: --pid *and* inotify |
Date: |
Thu, 30 Jul 2009 16:19:52 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
I found another bug I think.
Hopefully the attached is OK, but
I'm not able to compile/test/push at the moment
due to gnulib submodule weirdness.
cheers,
Pádraig.
>From 45e2e5f26d4d7641c3ef2bfc3e47aab5bc93b8fe Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Thu, 30 Jul 2009 15:29:13 +0100
Subject: [PATCH] tail: fix fractional seconds when monitoring a pid
* src/tail.c (tail_forever_inotify): The fractional
part of the delay was 1000 times to large.
* tests/tail-2/pid: Add a test to ensure the
timeout happens for this case.
---
src/tail.c | 2 +-
tests/tail-2/pid | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index 5efaf57..8aa31d5 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1268,7 +1268,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t
n_files,
FD_SET (wd, &rfd);
select_timeout.tv_sec = (time_t) sleep_interval;
- select_timeout.tv_usec = 1000000000 * (sleep_interval
+ select_timeout.tv_usec = 1000000 * (sleep_interval
- select_timeout.tv_sec);
n_descriptors = select (wd + 1, &rfd, NULL, NULL, &select_timeout);
diff --git a/tests/tail-2/pid b/tests/tail-2/pid
index 446c6db..ccf7823 100755
--- a/tests/tail-2/pid
+++ b/tests/tail-2/pid
@@ -70,4 +70,8 @@ fi
getlimits_
tail --pid=$INT_MAX -f /dev/null || fail=1
+# Ensure sleep parameter is honoured with --pid
+timeout 1 tail -s.1 -f /dev/null --pid=$PID_T_MAX
+test $? = 124 && fail=1
+
Exit $fail
--
1.6.2.5