aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-17 10:24:54 -0700
committerPaul Eggert2013-07-17 10:24:54 -0700
commita0931322f6c257bb4a4a678f62dcb4ae3b253221 (patch)
tree2c597df44098b26fb66026354ef17738ee922635 /src/eval.c
parent5dc8a629877b040a5dd5904815ed885949614948 (diff)
downloademacs-a0931322f6c257bb4a4a678f62dcb4ae3b253221.tar.gz
emacs-a0931322f6c257bb4a4a678f62dcb4ae3b253221.zip
* lread.c: Fix file descriptor leaks and errno issues.
(Fload): Close some races that leaked fds or streams when 'load' was interrupted. (Fload, openp): Report error number of last nontrivial failure to open. ENOENT counts as trivial. * eval.c (do_nothing, clear_unwind_protect, set_unwind_protect_ptr): New functions. * fileio.c (close_file_unwind): No need to test whether FD is nonnegative, now that the function is always called with a nonnegative arg. * lisp.h (set_unwind_protect_ptr, set_unwind_protect_int): Remove. All uses replaced with ... (clear_unwind_protect, set_unwind_protect_ptr): New decls.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index 6632084146f..a4f94ee1415 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3225,6 +3225,27 @@ record_unwind_protect_void (void (*function) (void))
3225 grow_specpdl (); 3225 grow_specpdl ();
3226} 3226}
3227 3227
3228static void
3229do_nothing (void)
3230{}
3231
3232void
3233clear_unwind_protect (ptrdiff_t count)
3234{
3235 union specbinding *p = specpdl + count;
3236 p->unwind_void.kind = SPECPDL_UNWIND_VOID;
3237 p->unwind_void.func = do_nothing;
3238}
3239
3240void
3241set_unwind_protect_ptr (ptrdiff_t count, void (*func) (void *), void *arg)
3242{
3243 union specbinding *p = specpdl + count;
3244 p->unwind_ptr.kind = SPECPDL_UNWIND_PTR;
3245 p->unwind_ptr.func = func;
3246 p->unwind_ptr.arg = arg;
3247}
3248
3228Lisp_Object 3249Lisp_Object
3229unbind_to (ptrdiff_t count, Lisp_Object value) 3250unbind_to (ptrdiff_t count, Lisp_Object value)
3230{ 3251{