int read_quit = 0;
Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
int we_locked_file = 0;
+ int deferred_remove_unwind_protect = 0;
if (current_buffer->base_buffer && ! NILP (visit))
error ("Cannot do file visiting in an indirect buffer");
UNGCPRO;
emacs_close (fd);
+ /* We should remove the unwind_protect calling
+ close_file_unwind, but other stuff has been added the stack,
+ so defer the removal till we reach the `handled' label. */
+ deferred_remove_unwind_protect = 1;
+
/* At this point, HOW_MUCH should equal TOTAL, or should be <= 0
if we couldn't read the file. */
handled:
+ if (deferred_remove_unwind_protect)
+ /* If requested above, discard the unwind protect for closing the
+ file. */
+ specpdl_ptr--;
+
if (!NILP (visit))
{
if (!EQ (current_buffer->undo_list, Qt) && !nochange)