diff --git a/pkgs/racket-doc/scribblings/reference/file-ports.scrbl b/pkgs/racket-doc/scribblings/reference/file-ports.scrbl index 969fea7a46..9ba02a24fa 100644 --- a/pkgs/racket-doc/scribblings/reference/file-ports.scrbl +++ b/pkgs/racket-doc/scribblings/reference/file-ports.scrbl @@ -95,8 +95,14 @@ to close it more automatically (see @secref["willexecutor"]). A @tech{path} value that is the @tech{cleanse}d version of @racket[path] is used as the name of the opened port. -If opening the file fails, if @racket[for-module?] is true, and +If opening the file fails due to an error in the filesystem, +then @exnraise[exn:fail:filesystem:errno]---as long as +@racket[for-module?] is @racket[#f], +@racket[current-module-path-for-load] has a non-@racket[#f] value, or +the filesystem error is not recognized as a file-not-found error. Otherwise, +when @racket[for-module?] is true, @racket[current-module-path-for-load] has a non-@racket[#f] value, +and the filesystem error is recognized as a file-not-found error, then the raised exception is either @racket[exn:fail:syntax:missing-module] (if the value of @racket[current-module-path-for-load] is a @tech{syntax object}) or @@ -194,6 +200,9 @@ to close it more automatically (see @secref["willexecutor"]). A @tech{path} value that is the @tech{cleanse}d version of @racket[path] is used as the name of the opened port. +If opening the file fails due to an error in the underlying filesystem +then @exnraise[exn:fail:filesystem:errno]. + @file-examples[ (define out (open-output-file some-file)) (write "hello world" out) diff --git a/racket/src/racket/src/port.c b/racket/src/racket/src/port.c index 58770af789..1e03860d1b 100644 --- a/racket/src/racket/src/port.c +++ b/racket/src/racket/src/port.c @@ -4660,7 +4660,7 @@ scheme_do_open_input_file(char *name, int offset, int argc, Scheme_Object *argv[ for_module = 1; } else if (SAME_OBJ(argv[i], scheme_none_symbol)) { mm_set++; - for_module = 1; + for_module = 0; } else { char *astr; intptr_t alen;