summaryrefslogtreecommitdiff
path: root/icc/iccstd.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:13:57 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:13:57 +0200
commit094535c010320967639e8e86f974d878e80baa72 (patch)
treeefc3094b20355dcbeebb2c4ece4fcfc69bffedb5 /icc/iccstd.c
parentc07d0c2d2f6f7b0eb6e92cc6204bf05037957e82 (diff)
Imported Upstream version 1.7.0upstream/1.7.0
Diffstat (limited to 'icc/iccstd.c')
-rw-r--r--icc/iccstd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/icc/iccstd.c b/icc/iccstd.c
index 742be4d..3f7966e 100644
--- a/icc/iccstd.c
+++ b/icc/iccstd.c
@@ -310,7 +310,6 @@ icmAlloc *al /* heap allocator, NULL for default */
) {
icmFileStd *p;
int del_al = 0;
- struct stat sbuf;
if (al == NULL) { /* None provided, create default */
if ((al = new_icmAllocStd()) == NULL)
@@ -334,8 +333,10 @@ icmAlloc *al /* heap allocator, NULL for default */
p->get_buf = icmFileStd_get_buf;
p->del = icmFileStd_delete;
- if (fstat(fileno(fp), &sbuf) == 0) {
- p->size = sbuf.st_size;
+ // fstat() is not so robust on MSWin.
+ if (fseek(fp, 0L, SEEK_END) == 0) {
+ p->size = ftell(fp);
+ fseek(fp, 0L, SEEK_SET);
} else {
p->size = 0;
}