]> git.donarmstrong.com Git - samtools.git/blobdiff - knetfile.c
* samtools-0.1.5-17 (r422)
[samtools.git] / knetfile.c
index bcf74a89024b5533941cf322ccc6e83c6d28210d..358ee6482c67619efc567355761655f517bb640d 100644 (file)
@@ -344,11 +344,12 @@ int knet_seek(knetFile *fp, off_t off, int whence)
 {
        if (whence == SEEK_SET && off == fp->offset) return 0;
        if (fp->type == KNF_TYPE_LOCAL) {
-               if (lseek(fp->fd, off, whence) == -1) {
+               off_t offset = lseek(fp->fd, off, whence);
+               if (offset == -1) {
                        perror("lseek");
                        return -1;
                }
-               fp->offset = off;
+               fp->offset = offset;
                return 0;
        } else if (fp->type == KNF_TYPE_FTP || fp->type == KNF_TYPE_HTTP) {
                if (whence != SEEK_SET) { // FIXME: we can surely allow SEEK_CUR and SEEK_END in future