diff options
| author | Paul Eggert | 2013-07-17 10:24:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-07-17 10:24:54 -0700 |
| commit | a0931322f6c257bb4a4a678f62dcb4ae3b253221 (patch) | |
| tree | 2c597df44098b26fb66026354ef17738ee922635 /src/eval.c | |
| parent | 5dc8a629877b040a5dd5904815ed885949614948 (diff) | |
| download | emacs-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.c | 21 |
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 | ||
| 3228 | static void | ||
| 3229 | do_nothing (void) | ||
| 3230 | {} | ||
| 3231 | |||
| 3232 | void | ||
| 3233 | clear_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 | |||
| 3240 | void | ||
| 3241 | set_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 | |||
| 3228 | Lisp_Object | 3249 | Lisp_Object |
| 3229 | unbind_to (ptrdiff_t count, Lisp_Object value) | 3250 | unbind_to (ptrdiff_t count, Lisp_Object value) |
| 3230 | { | 3251 | { |