[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 06/08: Fix error reporting in 'load-thunk-from-memory'.
From: |
Mark H. Weaver |
Subject: |
[Guile-commits] 06/08: Fix error reporting in 'load-thunk-from-memory'. |
Date: |
Mon, 11 Jun 2018 10:22:24 -0400 (EDT) |
mhw pushed a commit to branch stable-2.2
in repository guile.
commit 9fbb36725634d05c3e46de7619e2f6019fbeb6fe
Author: Mark H Weaver <address@hidden>
Date: Mon Jun 11 01:06:34 2018 -0400
Fix error reporting in 'load-thunk-from-memory'.
Previously 'load-thunk-from-memory' would often throw to 'system-error'
based on a stale value in 'errno', leading to incorrect error messages.
* libguile/loader.c (load_thunk_from_memory): Set 'errno' to 0 before
jumping to cleanup in the ABORT preprocessor macro, and also in the case
when 'process_dynamic_segment' reports an error.
---
libguile/loader.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libguile/loader.c b/libguile/loader.c
index 26a7343..743c8b0 100644
--- a/libguile/loader.c
+++ b/libguile/loader.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2001, 2009, 2010, 2011, 2012
- * 2013, 2014, 2015, 2017 Free Software Foundation, Inc.
+ * 2013, 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -341,7 +341,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)
@@ -460,7 +460,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);
- [Guile-commits] branch stable-2.2 updated (9a72e21 -> ac9f083), Mark H. Weaver, 2018/06/11
- [Guile-commits] 01/08: Fix typo in comment within numbers.c, Mark H. Weaver, 2018/06/11
- [Guile-commits] 05/08: goops: Fix 'instance?' to work on objects that aren't structs., Mark H. Weaver, 2018/06/11
- [Guile-commits] 06/08: Fix error reporting in 'load-thunk-from-memory'.,
Mark H. Weaver <=
- [Guile-commits] 02/08: Revert "Minor CSE run-time optimization", Mark H. Weaver, 2018/06/11
- [Guile-commits] 08/08: Add copyright header for (language elisp falias), and fix typo., Mark H. Weaver, 2018/06/11
- [Guile-commits] 07/08: elisp: Fix cross-compilation support., Mark H. Weaver, 2018/06/11
- [Guile-commits] 03/08: Fix type inference for bitwise logical operators., Mark H. Weaver, 2018/06/11
- [Guile-commits] 04/08: Avoid inexact arithmetic in the type inferrer for 'sqrt'., Mark H. Weaver, 2018/06/11