1
1

2000-03-31 Andrew V. Samoilov <sav@bcs.zp.ua>

* vfs.c (mc_def_getlocalcopy): free() replaced by g_free() to prevent
	  crushes with mad, thanks to Timur I. Bakeyev <timur@bat.ru>
	* fish.c (linear_start): name wasn't freed after usage
	* cpio.c (cpio_ungetlocalcopy): return type changed to int,
	  function return 0 now
	* direntry.c (vfs_s_close, vfs_s_resolve_symlink): memory, allocated
	  by vfs_s_fullpath () is freed after use
	* ftpfs.c (linear_start): ditto;
Этот коммит содержится в:
Pavel Machek 2000-04-05 13:08:42 +00:00
родитель d56d6fdb14
Коммит 425dbd07c1
6 изменённых файлов: 28 добавлений и 15 удалений

Просмотреть файл

@ -1,3 +1,14 @@
2000-03-31 Andrew V. Samoilov <sav@bcs.zp.ua>
* vfs.c (mc_def_getlocalcopy): free() replaced by g_free() to prevent
crushes with mad, thanks to Timur I. Bakeyev <timur@bat.ru>
* fish.c (linear_start): name wasn't freed after usage
* cpio.c (cpio_ungetlocalcopy): return type changed to int,
function return 0 now
* direntry.c (vfs_s_close, vfs_s_resolve_symlink): memory, allocated
by vfs_s_fullpath () is freed after use
* ftpfs.c (linear_start): ditto;
2000-04-03 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* ftpfs.c (send_ftp_command): return from vfs_s_get_path_mangle is

Просмотреть файл

@ -31,7 +31,7 @@
/* #include "utilvfs.h" */
#include "../src/dialog.h"
//#include "cpio.h"
/* #include "cpio.h" */
#include "names.h"
enum {
@ -574,10 +574,11 @@ static int cpio_read(void *fh, char *buffer, int count)
return count;
}
static void cpio_ungetlocalcopy(vfs *me, char *path, char *local, int has_changed)
static int cpio_ungetlocalcopy(vfs *me, char *path, char *local, int has_changed)
{
/* We do just nothing. (We are read only and do not need to free local,
since it will be freed when tar archive will be freed */
return 0;
}
static int cpio_fh_open(vfs *me, vfs_s_fh *fh, int flags, int mode)

Просмотреть файл

@ -229,7 +229,6 @@ vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, int follow, int f
{
unsigned int pseg;
vfs_s_entry *ent = NULL;
int found;
char p[MC_MAXPATHLEN] = "";
while (1){
@ -248,7 +247,6 @@ vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, int follow, int f
strncpy (p + (t = strlen (p)), path, pseg);
p[t + pseg] = '\0';
found = 0;
for (ent = root->subdir; ent != NULL; ent = ent->next)
if (strlen (ent->name) == pseg && (!strncmp (ent->name, path, pseg)))
/* FOUND! */
@ -376,7 +374,9 @@ vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
if (*linkname == PATH_SEP)
return (MEDATA->find_entry) (me, entry->dir->super->root, linkname, follow - 1, 0);
else { /* FIXME: this does not work */
sprintf(buf, "%s/%s", vfs_s_fullpath(me, entry->dir), linkname);
char *fullpath = vfs_s_fullpath(me, entry->dir);
sprintf(buf, "%s/%s", fullpath, linkname);
g_free (fullpath);
return (MEDATA->find_entry) (me, entry->dir->super->root, buf, follow - 1, 0);
}
}
@ -411,10 +411,6 @@ vfs_s_new_super (vfs *me)
vfs_s_super *super;
super = g_new0 (struct vfs_s_super, 1);
super->root = NULL;
super->name = NULL;
super->fd_usage = 0;
super->ino_usage = 0;
super->me = me;
return super;
}
@ -557,7 +553,7 @@ vfs_s_fullpath (vfs *me, vfs_s_inode *ino)
ERRNOR (EAGAIN, NULL);
if ((!ino->ent->dir) || (!ino->ent->dir->ent)) /* It must be directory */
return g_strconcat( ino->ent->name, NULL );
return g_strdup (ino->ent->name);
return g_strconcat (ino->ent->dir->ent->name, PATH_SEP_STR,
ino->ent->name, NULL);
@ -917,8 +913,10 @@ vfs_s_close (void *fh)
char *s = vfs_s_fullpath (me, FH->ino);
if (!s)
res = -1;
else
else {
res = MEDATA->file_store (me, FH_SUPER, s, FH->ino->localname);
g_free (s);
}
vfs_s_invalidate (me, FH_SUPER);
}
if (FH->handle)

Просмотреть файл

@ -514,7 +514,7 @@ static int linear_start(vfs *me, vfs_s_fh *fh, int offset)
name = vfs_s_fullpath (me, fh->ino);
if (!name)
return 0;
if (command(me, FH_SUPER, WANT_STRING,
offset = command(me, FH_SUPER, WANT_STRING,
"#RETR /%s\n"
"ls -l \"/%s\" | (\n"
"read var1 var2 var3 var4 var5 var6\n"
@ -523,8 +523,9 @@ static int linear_start(vfs *me, vfs_s_fh *fh, int offset)
"echo '### 100'\n"
"cat \"/%s\"\n"
"echo '### 200'\n",
name, name, name )
!= PRELIM) ERRNOR (E_REMOTE, 0);
name, name, name );
g_free (name);
if (offset != PRELIM) ERRNOR (E_REMOTE, 0);
fh->linear = LS_LINEAR_OPEN;
fh->u.fish.got = 0;
if (sscanf( reply_str, "%d", &fh->u.fish.total )!=1)

Просмотреть файл

@ -81,6 +81,7 @@ What to do with this?
#include "vfs.h"
#include "tcputil.h"
#include "../src/dialog.h"
#include "../src/setup.h" /* for load_anon_passwd */
#include "container.h"
#include "ftpfs.h"
#ifndef MAXHOSTNAMELEN
@ -1368,6 +1369,7 @@ linear_start(vfs *me, vfs_s_fh *fh, int offset)
if (!name)
return 0;
FH_SOCK = open_data_connection(me, FH_SUPER, "RETR", name, TYPE_BINARY, offset);
g_free (name);
if (FH_SOCK == -1)
ERRNOR (EACCES, 0);
fh->linear = LS_LINEAR_OPEN;

Просмотреть файл

@ -1093,7 +1093,7 @@ mc_def_getlocalcopy (vfs *vfs, char *filename)
fail:
if (fdout) close(fdout);
if (fdin) mc_close (fdin);
free (tmp);
g_free (tmp);
return NULL;
}