mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Ticket #1729: extfs: fail copying into arhive
Test case: * create any zip-archive (or take exists) * run mc * enter into archive * try to copy any files inside archive. Fix issue: Try to open temporarry file twice: with O_CREATE flag; and without O_CREATE and with O_TRUNC flag Also, created extfs_chown() function for avoid chown-related warnings. Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
a1a2164170
commit
f589410ced
17
vfs/extfs.c
17
vfs/extfs.c
@ -720,6 +720,13 @@ extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
|
||||
local_handle =
|
||||
open (entry->inode->local_filename, NO_LINEAR (flags), mode);
|
||||
|
||||
if (local_handle == -1) {
|
||||
/* file exists(may be). Need to drop O_CREAT flag and truncate file content */
|
||||
flags = ~O_CREAT & (NO_LINEAR (flags)|O_TRUNC);
|
||||
local_handle = open (entry->inode->local_filename, flags , mode);
|
||||
}
|
||||
|
||||
if (local_handle == -1)
|
||||
ERRNOR (EIO, NULL);
|
||||
|
||||
@ -1019,6 +1026,15 @@ cleanup:
|
||||
return result;
|
||||
}
|
||||
|
||||
static int extfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
{
|
||||
(void) me;
|
||||
(void) path;
|
||||
(void) owner;
|
||||
(void) group;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int extfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
{
|
||||
(void) me;
|
||||
@ -1414,6 +1430,7 @@ init_extfs (void)
|
||||
vfs_extfs_ops.lstat = extfs_lstat;
|
||||
vfs_extfs_ops.fstat = extfs_fstat;
|
||||
vfs_extfs_ops.chmod = extfs_chmod;
|
||||
vfs_extfs_ops.chown = extfs_chown;
|
||||
vfs_extfs_ops.readlink = extfs_readlink;
|
||||
vfs_extfs_ops.unlink = extfs_unlink;
|
||||
vfs_extfs_ops.chdir = extfs_chdir;
|
||||
|
Loading…
Reference in New Issue
Block a user