Mercurial > emacs
comparison src/fileio.c @ 99554:ae79259858c8
(Finsert_file_contents): Decrement specpdl_ptr to avoid double file
close.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 14 Nov 2008 21:11:15 +0000 |
parents | 5ebd631975e0 |
children | ee0ea39bc6a3 |
comparison
equal
deleted
inserted
replaced
99553:54af6e9e3b4e | 99554:ae79259858c8 |
---|---|
3142 int set_coding_system = 0; | 3142 int set_coding_system = 0; |
3143 Lisp_Object coding_system; | 3143 Lisp_Object coding_system; |
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"); |
3150 | 3151 |
3151 if (!NILP (current_buffer->read_only)) | 3152 if (!NILP (current_buffer->read_only)) |
3653 if (coding.carryover_bytes > 0) | 3654 if (coding.carryover_bytes > 0) |
3654 bcopy (coding.carryover, read_buf, unprocessed); | 3655 bcopy (coding.carryover, read_buf, unprocessed); |
3655 } | 3656 } |
3656 UNGCPRO; | 3657 UNGCPRO; |
3657 emacs_close (fd); | 3658 emacs_close (fd); |
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; | |
3658 | 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 |
3662 if (how_much < 0) | 3668 if (how_much < 0) |
4034 else | 4040 else |
4035 current_buffer->buffer_file_type = Qnil; | 4041 current_buffer->buffer_file_type = Qnil; |
4036 #endif | 4042 #endif |
4037 | 4043 |
4038 handled: | 4044 handled: |
4045 | |
4046 if (deferred_remove_unwind_protect) | |
4047 /* If requested above, discard the unwind protect for closing the | |
4048 file. */ | |
4049 specpdl_ptr--; | |
4039 | 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) |
4043 current_buffer->undo_list = Qnil; | 4054 current_buffer->undo_list = Qnil; |