X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=razf.c;h=e7499f9f61e6c2fae4ec71a5f4a500ed5b151fe8;hb=3a1bd4d97b4d58148b5a7fd845a3b6a023eecbed;hp=9b9267e494fe95cddde5e1e31c50cfc958701a11;hpb=32c42f6715535ee4d46332cf4ffc866062c6a754;p=samtools.git diff --git a/razf.c b/razf.c index 9b9267e..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 @@ -511,9 +512,9 @@ static inline RAZF* _razf_open(const char *filename, const char *mode, int _load rz = razf_open_r(fd, _load_index); } else if(strstr(mode, "w")){ #ifdef _WIN32 - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); #else - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); #endif if(fd < 0) return NULL; rz = razf_open_w(fd);