Changeset: 1a50f3948128 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a50f3948128
Modified Files:
        common/stream/stream.c
Branch: default
Log Message:

Windows ftell and fseek are undefined on unseekable files.
That is undefined, not give an error or anything useful like that.


diffs (20 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -2585,6 +2585,7 @@ file_rastream(FILE *fp, const char *name
        stream *s;
        lng pos;
        char buf[UTF8BOMLENGTH + 1];
+       struct stat stb;
 
        if (fp == NULL)
                return NULL;
@@ -2595,7 +2596,7 @@ file_rastream(FILE *fp, const char *name
                return NULL;
        s->type = ST_ASCII;
        s->stream_data.p = (void *) fp;
-       if (!isatty(fileno(fp)) && file_fgetpos(s, &pos) == 0) {
+       if (fstat(fileno(fp), &stb) == 0 && S_ISREG(stb.st_mode) && 
file_fgetpos(s, &pos) == 0) {
                if (file_read(s, buf, 1, UTF8BOMLENGTH) == UTF8BOMLENGTH &&
                    strncmp(buf, UTF8BOM, UTF8BOMLENGTH) == 0) {
                        s->isutf8 = 1;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to