Ticket #3650: patchfile.patch

File patchfile.patch, 5.1 KB (added by Nicolas Rybkin, 5 years ago)
  • src/filemanager/file.c

    diff -uNr mc-4.8.17.orig/src/filemanager/file.c mc-4.8.17/src/filemanager/file.c
    old new  
     1 
    12/* 
    23   File management. 
    34 
     
    5960#include <sys/types.h> 
    6061#include <sys/stat.h> 
    6162#include <unistd.h> 
     63#include <utime.h> 
    6264 
    6365#include "lib/global.h" 
    6466#include "lib/tty/tty.h" 
     
    8385#include "midnight.h"           /* current_panel */ 
    8486#include "layout.h"             /* rotate_dash() */ 
    8587#include "ioblksize.h"          /* io_blksize() */ 
     88#include "src/vfs/extfs/extfs.h"/* for copy to extfs */ 
    8689 
    8790#include "file.h" 
    8891 
     
    14971500    int open_flags; 
    14981501    vfs_path_t *src_vpath = NULL, *dst_vpath = NULL; 
    14991502    char *buf = NULL; 
     1503    struct vfs_class *vfs; 
     1504    struct pseudofile *fsinfo = NULL; 
    15001505 
    15011506    /* FIXME: We should not be using global variables! */ 
    15021507    ctx->do_reget = 0; 
     
    19341939        break; 
    19351940    } 
    19361941 
     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 
    19371954    while (dest_desc != -1 && mc_close (dest_desc) < 0 && !ctx->skip_all) 
    19381955    { 
    19391956        temp_status = file_error (_("Cannot close target file \"%s\"\n%s"), dst_path); 
  • src/vfs/extfs/extfs.c

    diff -uNr mc-4.8.17.orig/src/vfs/extfs/extfs.c mc-4.8.17/src/vfs/extfs/extfs.c
    old new  
    7575 
    7676/*** file scope type declarations ****************************************************************/ 
    7777 
    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; 
    13378 
    13479/*** file scope variables ************************************************************************/ 
    13580 
     
    422367        } 
    423368 
    424369        tmp = name_quote (vfs_path_get_last_path_str (name_vpath), FALSE); 
     370 
    425371    } 
    426372 
    427373    cmd = g_strconcat (info->path, info->prefix, " list ", 
  • src/vfs/extfs/extfs.h

    diff -uNr mc-4.8.17.orig/src/vfs/extfs/extfs.h mc-4.8.17/src/vfs/extfs/extfs.h
    old new  
    66/*** enums ***************************************************************************************/ 
    77 
    88/*** structures declarations (and typedefs of structures)*****************************************/ 
     9struct 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 
     29struct entry 
     30{ 
     31    struct entry *next_in_dir; 
     32    struct entry *dir; 
     33    char *name; 
     34    struct inode *inode; 
     35}; 
     36 
     37struct pseudofile 
     38{ 
     39    struct archive *archive; 
     40    gboolean has_changed; 
     41    int local_handle; 
     42    struct entry *entry; 
     43}; 
     44 
     45struct 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 
     58typedef struct 
     59{ 
     60    char *path; 
     61    char *prefix; 
     62    gboolean need_archive; 
     63} extfs_plugin_info_t; 
    964 
    1065/*** global variables defined in .c file *********************************************************/ 
    1166