diff -uNr mc-4.8.17.orig/src/filemanager/file.c mc-4.8.17/src/filemanager/file.c
old
|
new
|
|
| 1 | |
1 | 2 | /* |
2 | 3 | File management. |
3 | 4 | |
… |
… |
|
59 | 60 | #include <sys/types.h> |
60 | 61 | #include <sys/stat.h> |
61 | 62 | #include <unistd.h> |
| 63 | #include <utime.h> |
62 | 64 | |
63 | 65 | #include "lib/global.h" |
64 | 66 | #include "lib/tty/tty.h" |
… |
… |
|
83 | 85 | #include "midnight.h" /* current_panel */ |
84 | 86 | #include "layout.h" /* rotate_dash() */ |
85 | 87 | #include "ioblksize.h" /* io_blksize() */ |
| 88 | #include "src/vfs/extfs/extfs.h"/* for copy to extfs */ |
86 | 89 | |
87 | 90 | #include "file.h" |
88 | 91 | |
… |
… |
|
1497 | 1500 | int open_flags; |
1498 | 1501 | vfs_path_t *src_vpath = NULL, *dst_vpath = NULL; |
1499 | 1502 | char *buf = NULL; |
| 1503 | struct vfs_class *vfs; |
| 1504 | struct pseudofile *fsinfo = NULL; |
1500 | 1505 | |
1501 | 1506 | /* FIXME: We should not be using global variables! */ |
1502 | 1507 | ctx->do_reget = 0; |
… |
… |
|
1934 | 1939 | break; |
1935 | 1940 | } |
1936 | 1941 | |
| 1942 | /* if destination fs is extfs do chown(), chmod() and utime() on |
| 1943 | local file copy before close destination file */ |
| 1944 | if ((vfs = vfs_class_find_by_handle (dest_desc, (void *) &fsinfo)) |
| 1945 | != NULL && !strcmp (vfs->name, "extfs")) |
| 1946 | { |
| 1947 | chown (fsinfo->entry->inode->local_filename, src_uid, src_gid); |
| 1948 | chmod (fsinfo->entry->inode->local_filename, (src_mode & |
| 1949 | ctx->umask_kill)); |
| 1950 | utime (fsinfo->entry->inode->local_filename, &utb); |
| 1951 | } |
| 1952 | /*---------------------------------------------------------------------*/ |
| 1953 | |
1937 | 1954 | while (dest_desc != -1 && mc_close (dest_desc) < 0 && !ctx->skip_all) |
1938 | 1955 | { |
1939 | 1956 | temp_status = file_error (_("Cannot close target file \"%s\"\n%s"), dst_path); |
diff -uNr mc-4.8.17.orig/src/vfs/extfs/extfs.c mc-4.8.17/src/vfs/extfs/extfs.c
old
|
new
|
|
75 | 75 | |
76 | 76 | /*** file scope type declarations ****************************************************************/ |
77 | 77 | |
78 | | struct inode |
79 | | { |
80 | | nlink_t nlink; |
81 | | struct entry *first_in_subdir; /* only used if this is a directory */ |
82 | | struct entry *last_in_subdir; |
83 | | ino_t inode; /* This is inode # */ |
84 | | dev_t dev; /* This is an internal identification of the extfs archive */ |
85 | | struct archive *archive; /* And this is an archive structure */ |
86 | | dev_t rdev; |
87 | | mode_t mode; |
88 | | uid_t uid; |
89 | | gid_t gid; |
90 | | off_t size; |
91 | | time_t mtime; |
92 | | char *linkname; |
93 | | time_t atime; |
94 | | time_t ctime; |
95 | | char *local_filename; |
96 | | }; |
97 | | |
98 | | struct entry |
99 | | { |
100 | | struct entry *next_in_dir; |
101 | | struct entry *dir; |
102 | | char *name; |
103 | | struct inode *inode; |
104 | | }; |
105 | | |
106 | | struct pseudofile |
107 | | { |
108 | | struct archive *archive; |
109 | | gboolean has_changed; |
110 | | int local_handle; |
111 | | struct entry *entry; |
112 | | }; |
113 | | |
114 | | struct archive |
115 | | { |
116 | | int fstype; |
117 | | char *name; |
118 | | char *local_name; |
119 | | struct stat local_stat; |
120 | | dev_t rdev; |
121 | | int fd_usage; |
122 | | ino_t inode_counter; |
123 | | struct entry *root_entry; |
124 | | struct archive *next; |
125 | | }; |
126 | | |
127 | | typedef struct |
128 | | { |
129 | | char *path; |
130 | | char *prefix; |
131 | | gboolean need_archive; |
132 | | } extfs_plugin_info_t; |
133 | 78 | |
134 | 79 | /*** file scope variables ************************************************************************/ |
135 | 80 | |
… |
… |
|
422 | 367 | } |
423 | 368 | |
424 | 369 | tmp = name_quote (vfs_path_get_last_path_str (name_vpath), FALSE); |
| 370 | |
425 | 371 | } |
426 | 372 | |
427 | 373 | cmd = g_strconcat (info->path, info->prefix, " list ", |
diff -uNr mc-4.8.17.orig/src/vfs/extfs/extfs.h mc-4.8.17/src/vfs/extfs/extfs.h
old
|
new
|
|
6 | 6 | /*** enums ***************************************************************************************/ |
7 | 7 | |
8 | 8 | /*** structures declarations (and typedefs of structures)*****************************************/ |
| 9 | struct inode |
| 10 | { |
| 11 | nlink_t nlink; |
| 12 | struct entry *first_in_subdir; /* only used if this is a directory */ |
| 13 | struct entry *last_in_subdir; |
| 14 | ino_t inode; /* This is inode # */ |
| 15 | dev_t dev; /* This is an internal identification of the extfs archive */ |
| 16 | struct archive *archive; /* And this is an archive structure */ |
| 17 | dev_t rdev; |
| 18 | mode_t mode; |
| 19 | uid_t uid; |
| 20 | gid_t gid; |
| 21 | off_t size; |
| 22 | time_t mtime; |
| 23 | char *linkname; |
| 24 | time_t atime; |
| 25 | time_t ctime; |
| 26 | char *local_filename; |
| 27 | }; |
| 28 | |
| 29 | struct entry |
| 30 | { |
| 31 | struct entry *next_in_dir; |
| 32 | struct entry *dir; |
| 33 | char *name; |
| 34 | struct inode *inode; |
| 35 | }; |
| 36 | |
| 37 | struct pseudofile |
| 38 | { |
| 39 | struct archive *archive; |
| 40 | gboolean has_changed; |
| 41 | int local_handle; |
| 42 | struct entry *entry; |
| 43 | }; |
| 44 | |
| 45 | struct archive |
| 46 | { |
| 47 | int fstype; |
| 48 | char *name; |
| 49 | char *local_name; |
| 50 | struct stat local_stat; |
| 51 | dev_t rdev; |
| 52 | int fd_usage; |
| 53 | ino_t inode_counter; |
| 54 | struct entry *root_entry; |
| 55 | struct archive *next; |
| 56 | }; |
| 57 | |
| 58 | typedef struct |
| 59 | { |
| 60 | char *path; |
| 61 | char *prefix; |
| 62 | gboolean need_archive; |
| 63 | } extfs_plugin_info_t; |
9 | 64 | |
10 | 65 | /*** global variables defined in .c file *********************************************************/ |
11 | 66 | |