--- backup/tail.c Sun Dec 10 01:19:29 2000 +++ tail.c Sun Dec 10 01:26:04 2000 @@ -362,8 +362,9 @@ /* Make `pos' a multiple of `BUFSIZ' (0 if the file is short), so that all reads will be on block boundaries, which might increase efficiency. */ pos -= bytes_read; - /* FIXME: check lseek return value */ - lseek (fd, pos, SEEK_SET); + + if( lseek (fd, pos, SEEK_SET) < 0 ) + error(0,errno, "%s: seek failed",pretty_filename); bytes_read = safe_read (fd, buffer, bytes_read); if (bytes_read == -1) { @@ -396,14 +397,14 @@ if (pos == 0) { /* Not enough lines in the file; print the entire file. */ - /* FIXME: check lseek return value */ - lseek (fd, (off_t) 0, SEEK_SET); + if( lseek (fd, (off_t) 0, SEEK_SET) ) + error(0,errno, "%s: seek failed",pretty_filename); dump_remainder (pretty_filename, fd, file_length); return 0; } pos -= BUFSIZ; - /* FIXME: check lseek return value */ - lseek (fd, pos, SEEK_SET); + if( lseek (fd, pos, SEEK_SET) ) + error(0,errno, "%s: seek failed",pretty_filename); } while ((bytes_read = safe_read (fd, buffer, BUFSIZ)) > 0); @@ -793,8 +794,10 @@ f->ino = new_stats.st_ino; f->n_unchanged_stats = 0; f->n_consecutive_size_changes = 0; - /* FIXME: check lseek return value */ - lseek (f->fd, f->size, SEEK_SET); + + if( lseek (f->fd, f->size, SEEK_SET) ) + error(0,errno, "%s: seek failed",pretty_name(f)); + } } @@ -891,8 +894,10 @@ { write_header (pretty_name (&f[i]), _("file truncated")); last = i; - /* FIXME: check lseek return value */ - lseek (f[i].fd, stats.st_size, SEEK_SET); + + if( lseek (f[i].fd, stats.st_size, SEEK_SET) ) + error(0,errno, "%s: seek failed",pretty_name (&f[i])); + f[i].size = stats.st_size; continue; } @@ -954,8 +959,8 @@ { if (S_ISREG (stats.st_mode)) { - /* FIXME: check lseek return value */ - lseek (fd, n_bytes, SEEK_CUR); + if( lseek (fd, n_bytes, SEEK_CUR) ) + error(0,errno, "%s: seek failed",pretty_filename); } else if (start_bytes (pretty_filename, fd, n_bytes)) { @@ -990,15 +995,15 @@ more bytes than have been requested. So reposition the file pointer to the incoming current position and print everything after that. */ - /* FIXME: check lseek return value */ - lseek (fd, current_pos, SEEK_SET); + if( lseek (fd, current_pos, SEEK_SET) ) + error(0,errno, "%s: seek failed",pretty_filename); } else { /* There are more bytes remaining than were requested. Back up. */ - /* FIXME: check lseek return value */ - lseek (fd, -n_bytes, SEEK_END); + if( lseek (fd, -n_bytes, SEEK_END) ) + error(0,errno, "%s: seek failed",pretty_filename); } dump_remainder (pretty_filename, fd, n_bytes); }