~ chicken-core (chicken-5) 6020e97b578b0276018fe7f2bd4608d477ce2bd6
commit 6020e97b578b0276018fe7f2bd4608d477ce2bd6 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Sat Oct 8 15:09:42 2011 +0200 Commit: Christian Kellermann <ckeen@pestilenz.org> CommitDate: Sat Oct 8 15:36:38 2011 +0200 handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists? Signed-off-by: Christian Kellermann <ckeen@pestilenz.org> diff --git a/runtime.c b/runtime.c index a6d7919f..f9f8459b 100644 --- a/runtime.c +++ b/runtime.c @@ -9246,8 +9246,12 @@ C_i_file_exists_p(C_word name, C_word file, C_word dir) res = stat(C_c_string(name), &buf); if(res != 0) { - if(errno == ENOENT) return C_SCHEME_FALSE; - else return C_fix(res); + switch(errno) { + case ENOENT: return C_SCHEME_FALSE; + case EOVERFLOW: return C_truep(dir) ? C_SCHEME_FALSE : C_SCHEME_TRUE; + case ENOTDIR: return C_SCHEME_FALSE; + default: return C_fix(res); + } } switch(buf.st_mode & S_IFMT) {Trap