]> granicus.if.org Git - python/commitdiff
Clear the error condition set by ftell().
authorGuido van Rossum <guido@python.org>
Mon, 27 Apr 1998 19:01:08 +0000 (19:01 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 27 Apr 1998 19:01:08 +0000 (19:01 +0000)
Objects/fileobject.c

index 49517c5c264d399916faac7c48814484378cf5ec..b744ab427bf8ee1e78d8cc8778bade1674672d4f 100644 (file)
@@ -416,6 +416,8 @@ new_buffersize(f, currentsize)
        if (fstat(fileno(f->f_fp), &st) == 0) {
                end = st.st_size;
                pos = ftell(f->f_fp);
+               if (pos < 0)
+                       clearerr(f->f_fp);
                if (end > pos && pos >= 0)
                        return end - pos + 1;
                /* Add 1 so if the file were to grow we'd notice. */