summaryrefslogtreecommitdiff
path: root/libguile/throw.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-11-04 13:35:19 +0100
committerAndy Wingo <wingo@pobox.com>2011-11-04 13:35:19 +0100
commit58e68be4bb41ccbcd25a249ca872f99acf8065d5 (patch)
tree7b0e7f4e91a776827aadcc7877e22e3b4f0206b0 /libguile/throw.c
parent148dfc2409786996834f6ee1d0fdda563db182c0 (diff)
downloadguile-58e68be4bb41ccbcd25a249ca872f99acf8065d5.tar.gz
more robust scm_exit_status
* libguile/throw.c (scm_exit_status): In one of my bogus patches, I managed to make #<unspecified> reach this function, causing a segfault on SCM_CAR. Refactor to be more robust.
Diffstat (limited to 'libguile/throw.c')
-rw-r--r--libguile/throw.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libguile/throw.c b/libguile/throw.c
index 4b3c75e9d..e3b5afa97 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -322,7 +322,7 @@ scm_handle_by_proc_catching_all (void *handler_data, SCM tag, SCM throw_args)
int
scm_exit_status (SCM args)
{
- if (!SCM_NULL_OR_NIL_P (args))
+ if (scm_is_pair (args))
{
SCM cqa = SCM_CAR (args);
@@ -330,8 +330,14 @@ scm_exit_status (SCM args)
return (scm_to_int (cqa));
else if (scm_is_false (cqa))
return EXIT_FAILURE;
+ else
+ return EXIT_SUCCESS;
}
- return EXIT_SUCCESS;
+ else if (scm_is_null (args))
+ return EXIT_SUCCESS;
+ else
+ /* A type error. Strictly speaking we shouldn't get here. */
+ return EXIT_FAILURE;
}