Navigation Menu

Skip to content

Commit

Permalink
load.c: Oops. Fixed compilation error made two commits ago.
Browse files Browse the repository at this point in the history
  • Loading branch information
orangea committed Dec 23, 2010
1 parent 7af1033 commit a26fbfc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/load.c
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit a26fbfc

Please sign in to comment.