Made the path argument to vfs->[l]stat constant. Created a new memory leak, which will be fixed soon.

This commit is contained in:
Roland Illig 2004-08-16 20:26:42 +00:00
parent b472c18c79
commit 789e5e9bcb
7 changed files with 21 additions and 20 deletions

View File

@ -642,7 +642,7 @@ vfs_s_chdir (struct vfs_class *me, const char *path)
/* --------------------------- stat and friends ---------------------------- */ /* --------------------------- stat and friends ---------------------------- */
static int static int
vfs_s_internal_stat (struct vfs_class *me, char *path, struct stat *buf, int flag) vfs_s_internal_stat (struct vfs_class *me, const char *path, struct stat *buf, int flag)
{ {
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
@ -653,13 +653,13 @@ vfs_s_internal_stat (struct vfs_class *me, char *path, struct stat *buf, int fla
} }
static int static int
vfs_s_stat (struct vfs_class *me, char *path, struct stat *buf) vfs_s_stat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return vfs_s_internal_stat (me, path, buf, FL_FOLLOW); return vfs_s_internal_stat (me, path, buf, FL_FOLLOW);
} }
static int static int
vfs_s_lstat (struct vfs_class *me, char *path, struct stat *buf) vfs_s_lstat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return vfs_s_internal_stat (me, path, buf, FL_NONE); return vfs_s_internal_stat (me, path, buf, FL_NONE);
} }

View File

@ -929,14 +929,15 @@ static void extfs_stat_move( struct stat *buf, struct inode *inode )
buf->st_ctime = inode->ctime; buf->st_ctime = inode->ctime;
} }
static int extfs_internal_stat (char *path, struct stat *buf, int resolve) static int extfs_internal_stat (const char *path, struct stat *buf, int resolve)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
struct entry *entry; struct entry *entry;
struct inode *inode; struct inode *inode;
char *path2 = g_strdup(path);
if ((q = extfs_get_path_mangle (path, &archive, 0, 0)) == NULL) if ((q = extfs_get_path_mangle (path2, &archive, 0, 0)) == NULL)
return -1; return -1;
entry = extfs_find_entry (archive->root_entry, q, 0, 0); entry = extfs_find_entry (archive->root_entry, q, 0, 0);
if (entry == NULL) if (entry == NULL)
@ -948,12 +949,12 @@ static int extfs_internal_stat (char *path, struct stat *buf, int resolve)
return 0; return 0;
} }
static int extfs_stat (struct vfs_class *me, char *path, struct stat *buf) static int extfs_stat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return extfs_internal_stat (path, buf, 1); return extfs_internal_stat (path, buf, 1);
} }
static int extfs_lstat (struct vfs_class *me, char *path, struct stat *buf) static int extfs_lstat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return extfs_internal_stat (path, buf, 0); return extfs_internal_stat (path, buf, 0);
} }

View File

@ -107,13 +107,13 @@ local_closedir (void *data)
} }
static int static int
local_stat (struct vfs_class *me, char *path, struct stat *buf) local_stat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return stat (path, buf); return stat (path, buf);
} }
static int static int
local_lstat (struct vfs_class *me, char *path, struct stat *buf) local_lstat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
#ifndef HAVE_STATLSTAT #ifndef HAVE_STATLSTAT
return lstat (path,buf); return lstat (path,buf);

View File

@ -851,7 +851,7 @@ mcfs_get_stat_info (mcfs_connection *mc, struct stat *buf)
} }
static int static int
mcfs_stat_cmd (int cmd, char *path, struct stat *buf) mcfs_stat_cmd (int cmd, const char *path, struct stat *buf)
{ {
char *remote_file; char *remote_file;
mcfs_connection *mc; mcfs_connection *mc;
@ -875,13 +875,13 @@ mcfs_stat_cmd (int cmd, char *path, struct stat *buf)
} }
static int static int
mcfs_stat (struct vfs_class *me, char *path, struct stat *buf) mcfs_stat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
return mcfs_stat_cmd (MC_STAT, path, buf); return mcfs_stat_cmd (MC_STAT, path, buf);
} }
static int static int
mcfs_lstat (struct vfs_class *me, char *path, struct stat *buf) mcfs_lstat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
int path_len = strlen (path); int path_len = strlen (path);
int entry_len = strlen (mcfs_readdir_data.dent.d_name); int entry_len = strlen (mcfs_readdir_data.dent.d_name);

View File

@ -200,13 +200,13 @@ sfs_open (struct vfs_class *me, const char *path, int flags, int mode)
return sfs_info; return sfs_info;
} }
static int sfs_stat (struct vfs_class *me, char *path, struct stat *buf) static int sfs_stat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
path = sfs_redirect (me, path); path = sfs_redirect (me, path);
return stat (path, buf); return stat (path, buf);
} }
static int sfs_lstat (struct vfs_class *me, char *path, struct stat *buf) static int sfs_lstat (struct vfs_class *me, const char *path, struct stat *buf)
{ {
path = sfs_redirect (me, path); path = sfs_redirect (me, path);
#ifndef HAVE_STATLSTAT #ifndef HAVE_STATLSTAT

View File

@ -1295,10 +1295,10 @@ static dir_entry *single_entry;
/* stat a single file */ /* stat a single file */
static int static int
smbfs_get_remote_stat (smbfs_connection * sc, char *path, struct stat *buf) smbfs_get_remote_stat (smbfs_connection * sc, const char *path, struct stat *buf)
{ {
uint16 attribute = aDIR | aSYSTEM | aHIDDEN; uint16 attribute = aDIR | aSYSTEM | aHIDDEN;
char *mypath = path; char *mypath = g_strdup(path);
DEBUG (3, ("smbfs_get_remote_stat(): mypath:%s\n", mypath)); DEBUG (3, ("smbfs_get_remote_stat(): mypath:%s\n", mypath));
@ -1346,7 +1346,7 @@ smbfs_search_dir_entry (dir_entry *dentry, const char *text, struct stat *buf)
} }
static int static int
smbfs_get_stat_info (smbfs_connection * sc, char *path, struct stat *buf) smbfs_get_stat_info (smbfs_connection * sc, const char *path, struct stat *buf)
{ {
char *p; char *p;
#if 0 #if 0
@ -1472,7 +1472,7 @@ smbfs_loaddir_by_name (struct vfs_class *me, const char *path)
} }
static int static int
smbfs_stat (struct vfs_class * me, char *path, struct stat *buf) smbfs_stat (struct vfs_class * me, const char *path, struct stat *buf)
{ {
smbfs_connection *sc; smbfs_connection *sc;
pstring server_url; pstring server_url;

View File

@ -39,8 +39,8 @@ struct vfs_class {
void *(*readdir) (void *vfs_info); void *(*readdir) (void *vfs_info);
int (*closedir) (void *vfs_info); int (*closedir) (void *vfs_info);
int (*stat) (struct vfs_class *me, /*FIXME:const*/ char *path, struct stat * buf); int (*stat) (struct vfs_class *me, const char *path, struct stat * buf);
int (*lstat) (struct vfs_class *me, /*FIXME: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, /*FIXME:const*/ char *path, int mode);