mcedit bugs?
- From: "Saso" <saso bojler dhs org>
- To: <mc-devel gnome org>
- Subject: mcedit bugs?
- Date: Tue, 25 Jun 2002 00:32:46 +0200
Hello,
Until recently I've been using RedHat 6.2 and mc shipped with it
(4.5.42-10). Now when I've switched to a newer version I've found out that
mcedit's behaviour changed somewhat. I am wondering if these changes are
deliberate or just bugs introduced?
In 4.5.42 when you ran 'mcedit <some-non-existent-file>' the file was
created, but also deleted if not saved. The last stable (and cvs version
too) create the file but do not delete it. I thought maybe the support for
this was dropped, but as far as I can see the code is still in place it's
just not working properly...Here's what I've figured out so far (please
correct me if I'm wrong):
(all the sources will refer to 4.5.55 since some things have changed in cvs
I haven't figured out yet)
A file is deleted when mcedit exits if edit->delete_file is set.
Edit->delete file is set in only one place: edit.c, line 426. It is set if
check_file_access returns 2. When check_file_access starts it tries to open
the file, if it fails it will create the file and than try to open it again.
If it fails again it means the file is read protected and it will than
return with code 2. Now, I don't see why somebody would like to delete the
file in this case. If by some chance the file is located in a user writable
directory, but the user does not have read permission for it, the file could
very well be just deleted! (luckily it doesn't happen, since I guess it
doesn't encounter any unlink() :-)). I've compared this to the 4.5.42
sources and changed the code so that delete_file seems to be working as it
should...The modified mcedit works as I would expect it to, but since I'm
unfamiliar with the code I don't know if there're any side effects :-)
Saso Slavicic
--- edit.c.old Sun Aug 12 20:02:56 2001
+++ edit.c Mon Jun 24 17:51:02 2002
@@ -380,6 +380,7 @@
edit_error_dialog (_ (" Error "), get_sys_error (catstrs (_ ("
Failed trying to open file for reading: "), filename, " ", 0)));
return 2;
}
+ edit->delete_file = 1;
}
#else
if ((file = open ((char *) filename, O_RDONLY)) < 0) {
@@ -421,10 +422,10 @@
} else {
int r;
r = check_file_access (edit, filename, &st);
-#if defined(MIDNIGHT) || defined(GTK)
+/*#if defined(MIDNIGHT) || defined(GTK)
if (r == 2)
return edit->delete_file = 1;
-#endif
+#endif*/
if (r)
return 1;
edit->stat1 = st;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]