mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Made the path argument to vfs->{chmod,chown,utime} constant.
This commit is contained in:
parent
dc70d154db
commit
e0bf99d516
@ -991,7 +991,7 @@ extfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int extfs_chmod (struct vfs_class *me, char *path, int mode)
|
static int extfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -691,18 +691,19 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, char *cmd, in
|
|||||||
|
|
||||||
#define PREFIX \
|
#define PREFIX \
|
||||||
char buf[BUF_LARGE]; \
|
char buf[BUF_LARGE]; \
|
||||||
char *rpath; \
|
char *rpath, *mpath; \
|
||||||
struct vfs_s_super *super; \
|
struct vfs_s_super *super; \
|
||||||
if (!(rpath = vfs_s_get_path_mangle(me, path, &super, 0))) \
|
if (!(rpath = vfs_s_get_path_mangle(me, mpath = g_strdup(path), &super, 0))) \
|
||||||
return -1; \
|
return -1; \
|
||||||
rpath = name_quote (rpath, 0);
|
rpath = name_quote (rpath, 0);
|
||||||
|
|
||||||
#define POSTFIX(flags) \
|
#define POSTFIX(flags) \
|
||||||
g_free (rpath); \
|
g_free (rpath); \
|
||||||
|
g_free (mpath); \
|
||||||
return fish_send_command(me, super, buf, flags);
|
return fish_send_command(me, super, buf, flags);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fish_chmod (struct vfs_class *me, char *path, int mode)
|
fish_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
PREFIX
|
PREFIX
|
||||||
g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
|
g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
|
||||||
@ -753,7 +754,7 @@ static int fish_symlink (struct vfs_class *me, char *setto, char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fish_chown (struct vfs_class *me, char *path, int owner, int group)
|
fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
char *sowner, *sgroup;
|
char *sowner, *sgroup;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
14
vfs/ftpfs.c
14
vfs/ftpfs.c
@ -1441,17 +1441,18 @@ static int ftpfs_ctl (void *fh, int ctlop, void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Warning: filename passed to this command is damaged */
|
|
||||||
static int
|
static int
|
||||||
ftpfs_send_command(struct vfs_class *me, char *filename, char *cmd, int flags)
|
ftpfs_send_command(struct vfs_class *me, const char *filename, const char *cmd, int flags)
|
||||||
{
|
{
|
||||||
char *rpath, *p;
|
char *rpath, *p, *mpath = g_strdup(filename);
|
||||||
struct vfs_s_super *super;
|
struct vfs_s_super *super;
|
||||||
int r;
|
int r;
|
||||||
int flush_directory_cache = (flags & OPT_FLUSH);
|
int flush_directory_cache = (flags & OPT_FLUSH);
|
||||||
|
|
||||||
if (!(rpath = vfs_s_get_path_mangle(me, filename, &super, 0)))
|
if (!(rpath = vfs_s_get_path_mangle(me, mpath, &super, 0))) {
|
||||||
|
g_free(mpath);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
p = ftpfs_translate_path (me, super, rpath);
|
p = ftpfs_translate_path (me, super, rpath);
|
||||||
r = ftpfs_command (me, super, WAIT_REPLY, cmd, p);
|
r = ftpfs_command (me, super, WAIT_REPLY, cmd, p);
|
||||||
g_free (p);
|
g_free (p);
|
||||||
@ -1462,6 +1463,7 @@ ftpfs_send_command(struct vfs_class *me, char *filename, char *cmd, int flags)
|
|||||||
ERRNOR (EPERM, -1);
|
ERRNOR (EPERM, -1);
|
||||||
if (flush_directory_cache)
|
if (flush_directory_cache)
|
||||||
vfs_s_invalidate(me, super);
|
vfs_s_invalidate(me, super);
|
||||||
|
g_free(mpath);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1484,7 +1486,7 @@ ftpfs_init_passwd(void)
|
|||||||
ftpfs_anonymous_passwd = g_strdup ("anonymous@");
|
ftpfs_anonymous_passwd = g_strdup ("anonymous@");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ftpfs_chmod (struct vfs_class *me, char *path, int mode)
|
static int ftpfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
char buf[BUF_SMALL];
|
char buf[BUF_SMALL];
|
||||||
|
|
||||||
@ -1492,7 +1494,7 @@ static int ftpfs_chmod (struct vfs_class *me, char *path, int mode)
|
|||||||
return ftpfs_send_command(me, path, buf, OPT_FLUSH);
|
return ftpfs_send_command(me, path, buf, OPT_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ftpfs_chown (struct vfs_class *me, char *path, int owner, int group)
|
static int ftpfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
ftpfs_errno = EPERM;
|
ftpfs_errno = EPERM;
|
||||||
|
@ -129,19 +129,19 @@ local_fstat (void *data, struct stat *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_chmod (struct vfs_class *me, char *path, int mode)
|
local_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
return chmod (path, mode);
|
return chmod (path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_chown (struct vfs_class *me, char *path, int owner, int group)
|
local_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
return chown (path, owner, group);
|
return chown (path, owner, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_utime (struct vfs_class *me, char *path, struct utimbuf *times)
|
local_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
return utime (path, times);
|
return utime (path, times);
|
||||||
}
|
}
|
||||||
|
10
vfs/mcfs.c
10
vfs/mcfs.c
@ -459,7 +459,7 @@ mcfs_rpc_path (int command, char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mcfs_rpc_path_int (int command, char *path, int data)
|
mcfs_rpc_path_int (int command, const char *path, int data)
|
||||||
{
|
{
|
||||||
mcfs_connection *mc;
|
mcfs_connection *mc;
|
||||||
char *remote_file;
|
char *remote_file;
|
||||||
@ -476,7 +476,7 @@ mcfs_rpc_path_int (int command, char *path, int data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mcfs_rpc_path_int_int (int command, char *path, int n1, int n2)
|
mcfs_rpc_path_int_int (int command, const char *path, int n1, int n2)
|
||||||
{
|
{
|
||||||
mcfs_connection *mc;
|
mcfs_connection *mc;
|
||||||
char *remote_file;
|
char *remote_file;
|
||||||
@ -919,19 +919,19 @@ mcfs_fstat (void *data, struct stat *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mcfs_chmod (struct vfs_class *me, char *path, int mode)
|
mcfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
return mcfs_rpc_path_int (MC_CHMOD, path, mode);
|
return mcfs_rpc_path_int (MC_CHMOD, path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mcfs_chown (struct vfs_class *me, char *path, int owner, int group)
|
mcfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
return mcfs_rpc_path_int_int (MC_CHOWN, path, owner, group);
|
return mcfs_rpc_path_int_int (MC_CHOWN, path, owner, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mcfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
|
mcfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
mcfs_connection *mc;
|
mcfs_connection *mc;
|
||||||
int status;
|
int status;
|
||||||
|
@ -216,19 +216,19 @@ static int sfs_lstat (struct vfs_class *me, const char *path, struct stat *buf)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfs_chmod (struct vfs_class *me, char *path, int mode)
|
static int sfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
path = sfs_redirect (me, path);
|
path = sfs_redirect (me, path);
|
||||||
return chmod (path, mode);
|
return chmod (path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfs_chown (struct vfs_class *me, char *path, int owner, int group)
|
static int sfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
path = sfs_redirect (me, path);
|
path = sfs_redirect (me, path);
|
||||||
return chown (path, owner, group);
|
return chown (path, owner, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
|
static int sfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
path = sfs_redirect (me, path);
|
path = sfs_redirect (me, path);
|
||||||
return utime (path, times);
|
return utime (path, times);
|
||||||
|
@ -824,7 +824,7 @@ smbfs_closedir (void *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_chmod (struct vfs_class *me, char *path, int mode)
|
smbfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||||
{
|
{
|
||||||
DEBUG(3, ("smbfs_chmod(path:%s, mode:%d)\n", path, mode));
|
DEBUG(3, ("smbfs_chmod(path:%s, mode:%d)\n", path, mode));
|
||||||
/* my_errno = EOPNOTSUPP;
|
/* my_errno = EOPNOTSUPP;
|
||||||
@ -833,7 +833,7 @@ smbfs_chmod (struct vfs_class *me, char *path, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_chown (struct vfs_class *me, char *path, int owner, int group)
|
smbfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||||
{
|
{
|
||||||
DEBUG(3, ("smbfs_chown(path:%s, owner:%d, group:%d)\n", path, owner, group));
|
DEBUG(3, ("smbfs_chown(path:%s, owner:%d, group:%d)\n", path, owner, group));
|
||||||
my_errno = EOPNOTSUPP; /* ready for your labotomy? */
|
my_errno = EOPNOTSUPP; /* ready for your labotomy? */
|
||||||
@ -841,7 +841,7 @@ smbfs_chown (struct vfs_class *me, char *path, int owner, int group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
|
smbfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
DEBUG(3, ("smbfs_utime(path:%s)\n", path));
|
DEBUG(3, ("smbfs_utime(path:%s)\n", path));
|
||||||
my_errno = EOPNOTSUPP;
|
my_errno = EOPNOTSUPP;
|
||||||
|
@ -43,9 +43,9 @@ struct vfs_class {
|
|||||||
int (*lstat) (struct vfs_class *me, const char *path, struct stat * buf);
|
int (*lstat) (struct vfs_class *me, const char *path, struct stat * buf);
|
||||||
int (*fstat) (void *vfs_info, struct stat * buf);
|
int (*fstat) (void *vfs_info, struct stat * buf);
|
||||||
|
|
||||||
int (*chmod) (struct vfs_class *me, /*FIXME:const*/ char *path, int mode);
|
int (*chmod) (struct vfs_class *me, const char *path, int mode);
|
||||||
int (*chown) (struct vfs_class *me, /*FIXME:const*/ char *path, int owner, int group);
|
int (*chown) (struct vfs_class *me, const char *path, int owner, int group);
|
||||||
int (*utime) (struct vfs_class *me, /*FIXME:const*/ char *path,
|
int (*utime) (struct vfs_class *me, const char *path,
|
||||||
struct utimbuf * times);
|
struct utimbuf * times);
|
||||||
|
|
||||||
int (*readlink) (struct vfs_class *me, /*FIXME:const*/ char *path, char *buf,
|
int (*readlink) (struct vfs_class *me, /*FIXME:const*/ char *path, char *buf,
|
||||||
|
Loading…
Reference in New Issue
Block a user