[PATCH] Re: extfs cleanup
Pavel Roskin
proski at gnu.org
Sat Dec 7 02:39:26 UTC 2002
On Sat, 7 Dec 2002, Adam Byrtek 'alpha' wrote:
> On Fri, Dec 06, 2002 at 01:11:40AM -0500, Pavel Roskin wrote:
> > I believe the reason is because extfs_open() issues "copyout" even
> > when the file is opened with O_TRUNC. This should be easy to fix.
> > I'm have added a FIXME to the source.
>
> Fixed. Patch attached.
I think O_TRUNC is better. You don't need the local copy if you are going
to erase the file, regardless of whether you want to create it or not.
Also, "created" should be moved after extfs_cmd(), so that mc doesn't try
to get a file that it just created.
I'm applying this patch:
========================
--- extfs.c
+++ extfs.c
@@ -658,8 +658,8 @@ extfs_open (vfs * me, char *file, int fl
return NULL;
close (local_handle);
- if (extfs_cmd (" copyout ", archive, entry, local_filename)
- && !created) {
+ if (!created && !(flags & O_TRUNC)
+ && extfs_cmd (" copyout ", archive, entry, local_filename)) {
unlink (local_filename);
free (local_filename);
my_errno = EIO;
========================
Testing shows that the contents of the archive is not reread after the
file has been copied there. The size of the new file is 0, its
permissions are 0777. But this problem is irrelevant to the patch, so I'm
applying it. I don't remember that copying to the archives ever worked
properly.
--
Regards,
Pavel Roskin
More information about the mc-devel
mailing list