diff options
-rw-r--r-- | stream.c | 2 | ||||
-rw-r--r-- | sysif.c | 7 | ||||
-rw-r--r-- | sysif.h | 2 |
3 files changed, 5 insertions, 6 deletions
@@ -675,7 +675,7 @@ static val stdio_seek(val stream, val offset, enum strm_whence whence) if (offset == zero && whence == strm_cur) { return stdio_ftell(h->f); } else { - if (stdio_fseek(h->f, offset, whence) != negone) { + if (stdio_fseek(h->f, offset, whence)) { utf8_decoder_init(&h->ud); h->unget_c = nil; return t; @@ -1364,14 +1364,13 @@ val stdio_ftell(FILE *f) #endif } -val stdio_fseek(FILE *f, val off, int whence) +int stdio_fseek(FILE *f, val off, int whence) { val self = lit("seek-stream"); #if HAVE_FSEEKO - return num_off_t(fseeko(f, off_t_num(off, self), whence)); + return fseeko(f, off_t_num(off, self), whence) == 0; #else - int ret = fseek(f, c_long(off, self), whence); - return (ret == -1) ? num_fast(ret) : stdio_ftell(f); + return fseek(f, c_long(off, self), whence) == 0; #endif } @@ -59,7 +59,7 @@ val statf(val path); off_t off_t_num(val num, val self); val num_off_t(off_t offnum); val stdio_ftell(FILE *); -val stdio_fseek(FILE *, val, int whence); +int stdio_fseek(FILE *, val, int whence); #if HAVE_GETEUID void repress_privilege(void); void drop_privilege(void); |