From 82ffa4b8fcfdcd4ec98563daa06ec135f66ad181 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 12 Jun 2007 18:31:12 +0200 Subject: inotail.c: Handle EINTR and EAGAIN in tail_pipe_lines() --- inotail.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'inotail.c') diff --git a/inotail.c b/inotail.c index e98a881..912db03 100644 --- a/inotail.c +++ b/inotail.c @@ -246,8 +246,12 @@ static ssize_t tail_pipe_lines(struct file_struct *f, unsigned long n_lines) while (1) { const char *p; - if ((rc = read(f->fd, tmp->buf, BUFFER_SIZE)) <= 0) - break; + if ((rc = read(f->fd, tmp->buf, BUFFER_SIZE)) <= 0) { + if (rc < 0 && (errno == EINTR || errno == EAGAIN)) + continue; + else + break; + } tmp->n_bytes = rc; tmp->n_lines = 0; tmp->next = NULL; @@ -280,10 +284,8 @@ static ssize_t tail_pipe_lines(struct file_struct *f, unsigned long n_lines) free(tmp); - /* XXX: Even necessary? */ if (rc < 0) { fprintf(stderr, "Error: Could not read from %s\n", pretty_name(f->name)); - rc = -1; goto err_out; } -- cgit v1.2.3-54-g00ecf net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-04-21 12:53:29 -0700
committerJames Morris <james.l.morris@oracle.com>2016-04-27 17:25:02 +1000
commitda20dfe6b50ea4c1a82797b7ee8655a370535d73 (patch)
treecaa0c865f34f8f6b458f244a0eeef69ea9f05016
parent9b091556a073a9f5f93e2ad23d118f45c4796a84 (diff)
fs: fix over-zealous use of "const"
When I was fixing up const recommendations from checkpatch.pl, I went overboard. This fixes the warning (during a W=1 build): include/linux/fs.h:2627:74: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id) Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.l.morris@oracle.com>