(Fset_buffer_multibyte): Fix arg for chars_in_text.
[bpt/emacs.git] / src / filelock.c
index 55be9fb..a3735bc 100644 (file)
@@ -100,7 +100,7 @@ typedef struct
 /* Write the name of the lock file for FN into LFNAME.  Length will be
    that of FN plus two more for the leading `.#' plus one for the null.  */
 #define MAKE_LOCK_NAME(lock, file) \
-  (lock = (char *) alloca (XSTRING (file)->size + 2 + 1), \
+  (lock = (char *) alloca (XSTRING (file)->size_byte + 2 + 1), \
    fill_in_lock_file_name (lock, (file)))
 
 static void
@@ -385,7 +385,14 @@ unlock_all_files ()
     {
       b = XBUFFER (XCONS (XCONS (tail)->car)->cdr);
       if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
-       unlock_file (b->file_truename);
+       {
+         register char *lfname;
+
+         MAKE_LOCK_NAME (lfname, b->file_truename);
+
+         if (current_lock_owner (0, lfname) == 2)
+           unlink (lfname);
+       }
     }
 }
 \f
@@ -421,6 +428,7 @@ if it should normally be locked.")
 
 /* Unlock the file visited in buffer BUFFER.  */
 
+void
 unlock_buffer (buffer)
      struct buffer *buffer;
 {