blob: 06c2b493ff0d2082776def13758234717a0c4074 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
--- Objects/fileobject.c.orig Sat Apr 11 00:16:34 1998
+++ Objects/fileobject.c Wed May 6 23:09:41 1998
@@ -415,7 +415,11 @@
struct stat st;
if (fstat(fileno(f->f_fp), &st) == 0) {
end = st.st_size;
- pos = ftell(f->f_fp);
+ pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR);
+ if (pos >= 0)
+ 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. */
|