From d416dfaa8cd65d48002d4479e3f29d847f199cf2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 19 Nov 2011 19:40:49 -0700 Subject: [PATCH] fix `copy-file' reporting of `exn:fail:filesystem:exists?' Fixes re-report for PR 12074 --- collects/tests/racket/path.rktl | 2 ++ src/racket/src/file.c | 1 + 2 files changed, 3 insertions(+) diff --git a/collects/tests/racket/path.rktl b/collects/tests/racket/path.rktl index a6a3618953..17b7c662be 100644 --- a/collects/tests/racket/path.rktl +++ b/collects/tests/racket/path.rktl @@ -129,6 +129,8 @@ (test #f copy-file/tf "tmp5" "down") (test #f copy-file/tf "tmp5" (build-path deepdir "moredeep" "tmp5y")) (test (file-size "tmp5") file-size "tmp5y") +(err/rt-test (copy-file "tmp5" "tmp5y") exn:fail:filesystem:exists?) +(err/rt-test (copy-file "no-such-tmp5" "tmp5y") (lambda (x) (not (exn:fail:filesystem:exists? x)))) (delete-file "tmp5y") (test #t rename-file-or-directory/tf "tmp5" "tmp5x") diff --git a/src/racket/src/file.c b/src/racket/src/file.c index 225fae5a0e..c86ecf6075 100644 --- a/src/racket/src/file.c +++ b/src/racket/src/file.c @@ -3908,6 +3908,7 @@ static Scheme_Object *copy_file(int argc, Scheme_Object **argv) if (!out) { scheme_close_input_port(in); has_err_val = !!err_val; + pre_exists = (err_val == EEXIST); goto failed; }