summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2009-08-11 15:22:35 +0200
committerKarel Zak <kzak@redhat.com>2009-08-11 15:22:35 +0200
commita8733a8867805e83890469f591025f396d77e20e (patch)
treebd37b15e16510dad0fda3b1fa8a6ee04f9de7111
parent909572eab5eb258ac748a543ef3169cbd79a0061 (diff)
downloadutil-linux-old-a8733a8867805e83890469f591025f396d77e20e.tar.gz
tailf: report inotify_add_watch() problems
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--text-utils/tailf.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index e44fc098..6a76ef45 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -141,12 +141,22 @@ watch_file_inotify(const char *filename, off_t *size)
return 0;
ffd = inotify_add_watch(fd, filename, EVENTS);
+ if (ffd == -1) {
+ if (errno == ENOSPC)
+ errx(EXIT_FAILURE, _("%s: cannot add inotify watch "
+ "(limit of inotify watches was reached)."),
+ filename);
+
+ err(EXIT_FAILURE, _("%s: cannot add inotify watch."), filename);
+ }
+
while (ffd >= 0) {
len = read(fd, buf, sizeof(buf));
if (len < 0 && (errno == EINTR || errno == EAGAIN))
continue;
if (len < 0)
- err(EXIT_FAILURE, "%s: cannot read inotify events", filename);
+ err(EXIT_FAILURE,
+ _("%s: cannot read inotify events"), filename);
for (e = 0; e < len; ) {
struct inotify_event *ev = (struct inotify_event *) &buf[e];