From a26fbfc16257fa42a3544e3ea809a90500e77292 Mon Sep 17 00:00:00 2001 From: orangea Date: Thu, 23 Dec 2010 13:18:05 -0800 Subject: [PATCH] load.c: Oops. Fixed compilation error made two commits ago. --- core/load.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/load.c b/core/load.c index 87095f97..6b682982 100644 --- a/core/load.c +++ b/core/load.c @@ -16,7 +16,13 @@ void potion_load_code(Potion *P, const char *filename) { PN buf, code; - int fd = open(filename, O_RDONLY | O_BINARY); + struct stat stats; + int fd = -1; + if (stat(filename, &stats) == -1) { + fprintf(stderr, "** %s does not exist.", filename); + return; + } + fd = open(filename, O_RDONLY | O_BINARY); if (fd == -1) { fprintf(stderr, "** could not open %s. check permissions.", filename); return; @@ -27,7 +33,7 @@ void potion_load_code(Potion *P, const char *filename) { code = potion_source_load(P, PN_NIL, buf); if (!PN_IS_PROTO(code)) { potion_run(P, potion_send( - potion_parse(P, buf), PN_compile, potion_str(P, filename), PN_NIL), POTION_JIT); + potion_parse(P, buf), PN_compile, potion_str(P, filename), PN_NIL), POTION_JIT); } } else { fprintf(stderr, "** could not read entire file: %s.", filename);