]> git.donarmstrong.com Git - samtools.git/commitdiff
Bug fix - faidx on RAZF compressed files now working.
authorPetr Danecek <pd3@sanger.ac.uk>
Tue, 6 Oct 2009 13:26:35 +0000 (13:26 +0000)
committerPetr Danecek <pd3@sanger.ac.uk>
Tue, 6 Oct 2009 13:26:35 +0000 (13:26 +0000)
knetfile.c
razf.c

index 0dee408c2255f8330bccbd9a1f58565b0ebd0cdb..da992ede02016e153fca2b824813eb34c3b9880c 100644 (file)
@@ -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 2ce364e91ecc2229bf17a2426194cc4b70a96df5..e7499f9f61e6c2fae4ec71a5f4a500ed5b151fe8 100644 (file)
--- 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