bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8496: some file locking code in insert-file-contents cannot be right


From: Eli Zaretskii
Subject: bug#8496: some file locking code in insert-file-contents cannot be right
Date: Thu, 14 Apr 2011 04:55:14 -0400

> Date: Thu, 14 Apr 2011 02:48:28 -0400
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 8496@debbugs.gnu.org
> Reply-To: Eli Zaretskii <eliz@gnu.org>
> 
> >      if (NILP (visit) && inserted > 0)
> >        {
> >    #ifdef CLASH_DETECTION
> >      if (!NILP (BVAR (current_buffer, file_truename))
> >          /* Make binding buffer-file-name to nil effective.  */
> >          && !NILP (BVAR (current_buffer, filename))
> >          && SAVE_MODIFF >= MODIFF)
> >        we_locked_file = 1;
> >    #endif /* CLASH_DETECTION */
> >      prepare_to_modify_buffer (GPT, GPT, NULL);
> >        }
> > 
> > The above code is equivalent to a no-op, since 'inserted' must
> > be zero here.
> 
> In Emacs 21.4a, the corresponding code was this:
> 
>     if (!NILP (visit))
>       {
>       ...
>   #ifdef CLASH_DETECTION
>       if (NILP (handler))
>         {
>           if (!NILP (current_buffer->file_truename))
>             unlock_file (current_buffer->file_truename);
>           unlock_file (filename);
>         }
>   #endif /* CLASH_DETECTION */

Sorry, that was wrong.  The previous version was this:

   if (NILP (visit) && total > 0)
     prepare_to_modify_buffer (PT, PT, NULL);

The ChangeLog entry for the change (in revision 62259) is this:

     (Finsert_file_contents): If we read 0 bytes from a special file,
     unlock the visited file if we locked it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]