diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-09-29 16:40:53 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-09-29 16:40:53 -0400 |
commit | 140afde9d7096bea0f8d5f6a04e5c41dd37ab40b (patch) | |
tree | 73b536b97f3207357fb30c4eb7b125ffd4eadf2c /libdimension/error.c | |
parent | 1b5a27c5412847b2e1c559e2d99ea0de884d4142 (diff) | |
download | dimension-140afde9d7096bea0f8d5f6a04e5c41dd37ab40b.tar.xz |
Fix race condition in error.c.
Diffstat (limited to 'libdimension/error.c')
-rw-r--r-- | libdimension/error.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libdimension/error.c b/libdimension/error.c index d7365fe..11b4805 100644 --- a/libdimension/error.c +++ b/libdimension/error.c @@ -40,7 +40,8 @@ dmnsn_report_error(dmnsn_severity severity, /* An error more severe than our resilience happened, bail out */ fprintf(stderr, "Dimension ERROR: %s, %s:%u: %s\n", func, file, line, str); - (*dmnsn_fatal)(); + dmnsn_fatal_error_fn *fatal = dmnsn_get_fatal_error_fn(); + (*fatal)(); exit(EXIT_FAILURE); /* Failsafe in case *dmnsn_fatal doesn't exit */ } else { /* A trivial error happened, warn and continue */ @@ -79,7 +80,8 @@ dmnsn_set_resilience(dmnsn_severity resilience) /* Tried to set an illegal resilience, bail out */ fprintf(stderr, "Dimension ERROR: %s, line %u: %s\n", DMNSN_FUNC, __LINE__, "Resilience has wrong value."); - (*dmnsn_fatal)(); + dmnsn_fatal_error_fn *fatal = dmnsn_get_fatal_error_fn(); + (*fatal)(); exit(EXIT_FAILURE); } |