aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2008-11-14 21:11:15 +0000
committerChong Yidong2008-11-14 21:11:15 +0000
commitdb65a627b0c9ac4fa48f84693c579eca79881b11 (patch)
tree446afafb879fb35bf7a5f3eba5e757660f3fcae3 /src
parent26ea70797ad96cbe090659d4e39bf5704afc51ad (diff)
downloademacs-db65a627b0c9ac4fa48f84693c579eca79881b11.tar.gz
emacs-db65a627b0c9ac4fa48f84693c579eca79881b11.zip
(Finsert_file_contents): Decrement specpdl_ptr to avoid double file
close.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index cd68f4eb911..998dc974c47 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3144,6 +3144,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3144 int read_quit = 0; 3144 int read_quit = 0;
3145 Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; 3145 Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
3146 int we_locked_file = 0; 3146 int we_locked_file = 0;
3147 int deferred_remove_unwind_protect = 0;
3147 3148
3148 if (current_buffer->base_buffer && ! NILP (visit)) 3149 if (current_buffer->base_buffer && ! NILP (visit))
3149 error ("Cannot do file visiting in an indirect buffer"); 3150 error ("Cannot do file visiting in an indirect buffer");
@@ -3656,6 +3657,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
3656 UNGCPRO; 3657 UNGCPRO;
3657 emacs_close (fd); 3658 emacs_close (fd);
3658 3659
3660 /* We should remove the unwind_protect calling
3661 close_file_unwind, but other stuff has been added the stack,
3662 so defer the removal till we reach the `handled' label. */
3663 deferred_remove_unwind_protect = 1;
3664
3659 /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0 3665 /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0
3660 if we couldn't read the file. */ 3666 if we couldn't read the file. */
3661 3667
@@ -4037,6 +4043,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
4037 4043
4038 handled: 4044 handled:
4039 4045
4046 if (deferred_remove_unwind_protect)
4047 /* If requested above, discard the unwind protect for closing the
4048 file. */
4049 specpdl_ptr--;
4050
4040 if (!NILP (visit)) 4051 if (!NILP (visit))
4041 { 4052 {
4042 if (!EQ (current_buffer->undo_list, Qt) && !nochange) 4053 if (!EQ (current_buffer->undo_list, Qt) && !nochange)