diff --git a/src/c/file.d b/src/c/file.d index 4d28b1e9a..1f8cad495 100755 --- a/src/c/file.d +++ b/src/c/file.d @@ -5328,7 +5328,9 @@ flisten(cl_object stream, FILE *fp) { /* regular file */ ecl_off_t old_pos = ecl_ftello(fp), end_pos; - unlikely_if (ecl_fseeko(fp, 0, SEEK_END) != 0) + unlikely_if (old_pos == -1 + || + ecl_fseeko(fp, 0, SEEK_END) != 0) file_libc_error(@[file-error], stream, "Unable to check file position", 0); end_pos = ecl_ftello(fp); diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 78f8c883c..f034018bd 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -533,7 +533,7 @@ si_spawn_subprocess(cl_object command, cl_object argv, cl_object environ, if (Null(pid)) { if (parent_write) close(parent_write); if (parent_read) close(parent_read); - if (parent_error) close(parent_error); + if (parent_error >= 0) close(parent_error); parent_write = 0; parent_read = 0; parent_error = 0;