diff --git a/src/core/io.c b/src/core/io.c index 2b8e06af..0f6703e9 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -167,7 +167,7 @@ JANET_CORE_FN(cfun_io_fopen, if (f != NULL) { #ifndef JANET_WINDOWS struct stat st; - fstat(f->_fileno, &st); + fstat(fileno(f), &st); if (S_ISDIR(st.st_mode)) { fclose(f); janet_panicf("cannot open directory: %s", fname);