From 8e17ff71947c61759c3474d7818fdd9e5fc6bcc9 Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Tue, 6 Oct 2009 13:26:35 +0000 Subject: [PATCH] Bug fix - faidx on RAZF compressed files now working. --- knetfile.c | 2 ++ razf.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/knetfile.c b/knetfile.c index 0dee408..da992ed 100644 --- a/knetfile.c +++ b/knetfile.c @@ -536,6 +536,7 @@ off_t knet_seek(knetFile *fp, int64_t off, int whence) * while fseek() returns zero on success. */ off_t offset = lseek(fp->fd, off, whence); if (offset == -1) { + fprintf(stderr,"[knet_seek] %s\n", strerror(errno)); return -1; } fp->offset = offset; @@ -567,6 +568,7 @@ off_t knet_seek(knetFile *fp, int64_t off, int whence) return fp->offset; } errno = EINVAL; + fprintf(stderr,"[knet_seek] %s\n", strerror(errno)); return -1; } diff --git a/razf.c b/razf.c index 2ce364e..e7499f9 100644 --- a/razf.c +++ b/razf.c @@ -444,7 +444,8 @@ static RAZF* razf_open_r(int fd, int _load_index){ goto UNSEEKABLE; } #ifdef _USE_KNETFILE - if(knet_seek(fp, rz->end, SEEK_SET) != rz->end){ + knet_seek(fp, rz->end, SEEK_SET); + if(knet_tell(fp) != rz->end){ knet_seek(fp, rz->in, SEEK_SET); #else if(lseek(fd, rz->end, SEEK_SET) != rz->end){ @@ -497,7 +498,7 @@ static inline RAZF* _razf_open(const char *filename, const char *mode, int _load #ifdef _USE_KNETFILE knetFile *fd = knet_open(filename, "r"); if (fd == 0) { - fprintf(stderr, "[_razf_open] fail to open remote file %s\n", filename); + fprintf(stderr, "[_razf_open] fail to open %s\n", filename); return NULL; } #else -- 2.39.2