diff --git a/libguile/loader.c b/libguile/loader.c index b56269356..f4ddfedf5 100644 --- a/libguile/loader.c +++ b/libguile/loader.c @@ -348,7 +348,7 @@ process_dynamic_segment (char *base, Elf_Phdr *dyn_phdr, return NULL; } -#define ABORT(msg) do { err_msg = msg; goto cleanup; } while (0) +#define ABORT(msg) do { err_msg = msg; errno = 0; goto cleanup; } while (0) static SCM load_thunk_from_memory (char *data, size_t len, int is_read_only) @@ -469,7 +469,10 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only) if ((err_msg = process_dynamic_segment (data, &ph[dynamic_segment], &init, &entry, &frame_maps))) - goto cleanup; + { + errno = 0; /* not an OS error */ + goto cleanup; + } if (scm_is_true (init)) scm_call_0 (init);