Re: BUG: viewing compressed files



On Sun, Jun 29, 2003 at 07:08:15PM -0400, Pavel Roskin wrote:
> > I can add, that F4 on gzipped file opens it correctly, but leaves broken
> > symlink after closing the editor. This happens in mc-4.6.0-2003-06-25-17
> > but not in 4.6.0 version.
> 
> It's a write lock.  It needs to be fixed.  Adam, it's your code.

Shame on me I didn't notice that filtered edit uses edit_insert_file
to init its buffer :( Simple fix attached with additional routine to
remove stale lock during editor cleanup...

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha               alpha debian org
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/        pgp 0xB25952C0
     |           
Index: edit.c
===================================================================
RCS file: /cvsroot/mc/mc/edit/edit.c,v
retrieving revision 1.77
diff -u -r1.77 edit.c
--- edit.c	30 May 2003 21:06:10 -0000	1.77
+++ edit.c	30 Jun 2003 07:13:56 -0000
@@ -441,6 +441,11 @@
 		edit_clean (edit);
 		return 1;
 	    }
+
+	    /* edit_insert_file has locked the file, remove the lock */
+	    if (edit->locked)
+		edit->locked = edit_unlock_file (edit->filename);
+
 	    edit->stack_disable = 0;
 	}
     }
@@ -583,6 +588,10 @@
     if (!edit)
 	return 0;
 
+    /* a stale lock, remove it */
+    if (edit->locked)
+	edit->locked = edit_unlock_file (edit->filename);
+    
     /* save cursor position */
     if (option_save_position)
 	edit_save_position (edit);

Attachment: pgpxY8H6ZT822.pgp
Description: PGP signature



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