]> git.saurik.com Git - apple/libc.git/blobdiff - gen/FreeBSD/err.c
Libc-1272.200.26.tar.gz
[apple/libc.git] / gen / FreeBSD / err.c
index 39fac8a587bf27924882540de47a0b65a007d900..f763764dd9c1f201572cd7d2ba1097528e1eb59f 100644 (file)
@@ -159,7 +159,13 @@ err_set_file(void *fp)
 void
 err_set_exit(void (*ef)(int))
 {
-       _e_err_exit.type = ERR_EXIT_FUNC;
+#ifdef __BLOCKS__
+       if (_e_err_exit.type == ERR_EXIT_BLOCK) {
+               Block_release(_e_err_exit.block);
+               _e_err_exit.block = NULL;
+       }
+#endif /* __BLOCKS__ */
+       _e_err_exit.type = ef ? ERR_EXIT_FUNC : ERR_EXIT_UNDEF;
        _e_err_exit.func = ef;
 }
 
@@ -167,7 +173,10 @@ err_set_exit(void (*ef)(int))
 void
 err_set_exit_b(void (^ef)(int))
 {
-       _e_err_exit.type = ERR_EXIT_BLOCK;
+       if (_e_err_exit.type == ERR_EXIT_BLOCK) {
+               Block_release(_e_err_exit.block);
+       }
+       _e_err_exit.type = ef ? ERR_EXIT_BLOCK : ERR_EXIT_UNDEF;
        _e_err_exit.block = Block_copy(ef);
 }
 #endif /* __BLOCKS__ */