diff options
Diffstat (limited to 'coreutils/tail.c')
| -rw-r--r-- | coreutils/tail.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c index cea63e840..3043a80d4 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
| @@ -251,7 +251,7 @@ static int pipe_lines(int fd, long int n_lines) | |||
| 251 | If `forever' is nonzero, keep reading from the end of the file | 251 | If `forever' is nonzero, keep reading from the end of the file |
| 252 | until killed. Return the number of bytes read from the file. */ | 252 | until killed. Return the number of bytes read from the file. */ |
| 253 | 253 | ||
| 254 | static long dump_remainder(int fd) | 254 | static long dump_remainder(const char *filename,, int fd) |
| 255 | { | 255 | { |
| 256 | char buffer[BUFSIZ]; | 256 | char buffer[BUFSIZ]; |
| 257 | int bytes_read; | 257 | int bytes_read; |
| @@ -582,7 +582,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos) | |||
| 582 | Buffer the text as a linked list of LBUFFERs, adding them as needed. | 582 | Buffer the text as a linked list of LBUFFERs, adding them as needed. |
| 583 | Return 0 if successful, 1 if an error occured. */ | 583 | Return 0 if successful, 1 if an error occured. */ |
| 584 | 584 | ||
| 585 | static int pipe_lines(int fd, long int n_lines) | 585 | static int pipe_lines(const char *filename, int fd, long int n_lines) |
| 586 | { | 586 | { |
| 587 | struct linebuffer { | 587 | struct linebuffer { |
| 588 | int nbytes, nlines; | 588 | int nbytes, nlines; |
| @@ -816,7 +816,7 @@ static int start_lines(const char *filename, int fd, long int n_lines) | |||
| 816 | If `forever' is nonzero, keep reading from the end of the file | 816 | If `forever' is nonzero, keep reading from the end of the file |
| 817 | until killed. Return the number of bytes read from the file. */ | 817 | until killed. Return the number of bytes read from the file. */ |
| 818 | 818 | ||
| 819 | static long dump_remainder(int fd) | 819 | static long dump_remainder(const char *filename, int fd) |
| 820 | { | 820 | { |
| 821 | char buffer[BUFSIZ]; | 821 | char buffer[BUFSIZ]; |
| 822 | int bytes_read; | 822 | int bytes_read; |
| @@ -891,7 +891,7 @@ static void tail_forever(char **names, int nfiles) | |||
| 891 | write_header(names[i], NULL); | 891 | write_header(names[i], NULL); |
| 892 | last = i; | 892 | last = i; |
| 893 | } | 893 | } |
| 894 | file_sizes[i] += dump_remainder(file_descs[i]); | 894 | file_sizes[i] += dump_remainder(names[i], file_descs[i]); |
| 895 | } | 895 | } |
| 896 | 896 | ||
| 897 | /* If none of the files changed size, sleep. */ | 897 | /* If none of the files changed size, sleep. */ |
| @@ -921,7 +921,7 @@ static int tail_bytes(const char *filename, int fd, off_t n_bytes) | |||
| 921 | lseek(fd, n_bytes, SEEK_CUR); | 921 | lseek(fd, n_bytes, SEEK_CUR); |
| 922 | else if (start_bytes(filename, fd, n_bytes)) | 922 | else if (start_bytes(filename, fd, n_bytes)) |
| 923 | return 1; | 923 | return 1; |
| 924 | dump_remainder(fd); | 924 | dump_remainder(filename, fd); |
| 925 | } else { | 925 | } else { |
| 926 | if (S_ISREG(stats.st_mode)) { | 926 | if (S_ISREG(stats.st_mode)) { |
| 927 | off_t current_pos, end_pos; | 927 | off_t current_pos, end_pos; |
| @@ -987,9 +987,9 @@ static int tail_lines(const char *filename, int fd, long int n_lines) | |||
| 987 | length = lseek(fd, (off_t) 0, SEEK_END); | 987 | length = lseek(fd, (off_t) 0, SEEK_END); |
| 988 | if (length != 0 && file_lines(filename, fd, n_lines, length)) | 988 | if (length != 0 && file_lines(filename, fd, n_lines, length)) |
| 989 | return 1; | 989 | return 1; |
| 990 | dump_remainder(fd); | 990 | dump_remainder(filename, fd); |
| 991 | } else | 991 | } else |
| 992 | return pipe_lines(fd, n_lines); | 992 | return pipe_lines(filename, fd, n_lines); |
| 993 | } | 993 | } |
| 994 | return 0; | 994 | return 0; |
| 995 | } | 995 | } |
