with the name resembling the original, but safe for scripts.
* direntry.c (vfs_s_open): Use it.
(vfs_s_retrieve_file): Likewise.
* extfs.c (extfs_open): Likewise.
* sfs.c (sfs_redirect): Likewise.
code reuse. Change all callers.
(vfs_s_getlocalcopy): New implementation. Don't use
mc_def_getlocalcopy(). Use vfs_s_open() to create local copy.
(vfs_s_ungetlocalcopy): New function.
* xdirentry.h: Add new field "flags" to struct vfs_s_subclass.
* extfs.c (extfs_ungetlocalcopy): Don't use
mc_def_ungetlocalcopy() in the dead branch.
* vfs.c (mc_def_getlocalcopy): Make static.
(mc_def_ungetlocalcopy): Likewise.
(vfs_s_free_inode): Remove support for "." and ".." entries.
* ftpfs.c (dir_load): Likewise.
Support for "." and ".." entries was a hack that could make the
cache non-traversible from inodes to the root and cause infinite
loop in vfs_s_fullpath().
Reported by Frédéric L. W. Meunier <lists1@pervalidus.net>
size. This fixes a security hole. Always start from the root.
Remove broken code for making symlinks relative.
(vfs_s_find_entry_tree): Protect against long path, since this
function uses a buffer of fixed size.
(vfs_s_fullpath): Implement support for archives (real trees).
calling vfs_register() in the file defining the VFS class.
* vfs.c (vfs_init): Register cpiofs in cpio.c.
(vfs_register): Rename to vfs_register_class(), remove "static".
* direntry.c (vfs_s_init_class): New function - generic VFS
class registraction for vfs_s descendants.
* cpio.c: Register VFS class locally.
* extfs.c (s_readlink): Fix return value and possible buffer
overflow.
* mcfs.c (mcfs_readlink): Fix return value.
* mcserv.c (do_readlink): Fix possible off-by-one.
(commands): Make const array and remove needless comma.
this flag is for VFS only, and causes side effects in Cygwin.
* extfs.c (extfs_open): Likewise.
* sfs.c (sfs_open): Likewise.
Reported by Pavel Tsekov <ptsekov@gmx.net>
(vfs_s_data.file_store): Change second argument
to (vfs_s_fh *fh).
* direntry.c (vfs_s_close): Adjust.
* fish.c (file_store): Likewise.
* ftpfs.c (file_store): Likewise. Use "APPE" if
fh->u.ftp.append is true.
(linear_start): Care about fh->u.ftp.append.
(ftpfs_fh_open): Likewise.
(vfs_s_retrieve_file): Set fh->handle to -1.
(vfs_s_read): Don't manipulate with FH->handle if it is -1.
(vfs_s_write): Likewise.
(vfs_s_close): Likewise.
and stat_size.
* vfs.c (vfs_s_resolve_symlink): Use snprintf
instead of sprintf.
(vfs_print_stats): Use off_t for have and need. Cast
have to double to eliminate negative percent(s).
Fix print_vfs_message string formats.
* vfs.h (vfs_print_stats): Adjust declaration.
* ftpfs.c (file_store): Use off_t for total.
Fix print_vfs_message string format.
* direntry.c: Likewise.
* fish.c: Likewise.
* ftpfs.c: Likewise.
* local.c: Likewise.
* tar.c: Likewise.
* utilvfs.h: Don't include <config.h> - it should be included
in all C files instead.
* xdirentry.h: Likewise.
* src/user.c (execute_menu_command): Use mc_mkstemps().
* src/util.c (mc_mkstemps): New function - safely create and
open temporary file. Return the handle and the name.
* src/util.h: Declarations for init_tmpdir() and mc_mkstemps().
Define TMPDIR_DEFAULT and SCRIPT_SUFFIX.
* vfs/direntry.c (vfs_s_open): Use mc_mkstemps. Create and close
temporary file to reserve its name on the filesystem.
(vfs_s_retrieve_file): Use mc_mkstemps().
(g_tempnam): Remove.
* vfs/extfs.c (extfs_open): Use mc_mkstemps().
* vfs/sfs.c (redirect): Likewise.
* vfs/shared_ftp_fish.c (_get_file_entry): Likewise.
(retrieve_file): Likewise.
* vfs/vfs.c (mc_def_getlocalcopy): Likewise.
* vfs/xdirentry.h: Remove declaration of g_tempnam().
* direntry.c (vfs_s_find_entry_tree): segfault fixed when root is NULL
(vfs_s_new_inode, vfs_s_new_entry): g_new replaced by g_new0
* ftpfs.c (dir_load): ent->name is free()d for "." and ".."
(ftpfs_directory_timeout): default value changed to 900
(netrc_next): "const char * const keywords" go to rodata and is shared
* 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;
* ftpfs.c: basically replaced ftpfs with new one. Unlike the
previous one, this uses new direntry.c layer, so shared_ftp_fish.c
can be killed.
This is new code, so beware.
* vfs/direntry.c (vfs_s_getlocalcopy): There's an aditional strdup
needed. In rare cases a pointer was freed twice. Pavel Machek
pointed this out a while ago but obviously it hasn't been fixed, yet.
* vfs/sfs.c (vfmake): Quote characters with a special meaning to the
shell in filenames/-pathes (Fix Bug #1931, VFS will not work if
your full path has the space character in it.).
Wed Jan 27 03:09:48 1999 Timur I. Bakeyev <mc@bat.ru>
* All around the source: Changed copy_strings() to g_strconcat(). Modi-
fy last parameter in concat_dir_and_file() to "" - to prevent stack from
disbalancing.
- SFS-based file systems now work on GNOME edition, I was
not waiting for child process to finish decompressing.
- VFS code cleanup. I am going to eventually get rid of all
the macro-mania that has creeped into the vfs layer.
Miguel
* sfs.c (sfs_nothingisopen): Assume for now it's always save to free
this filesystem and delete temporary files. This needs further
investigation.
* tar.c: deleted unused empty struct tar_super.
Thu Dec 31 08:40:44 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* direntry.c: Split fd_usage into fd_usage and ino_usage. fd_usage
was used for external and internal reference count. This was wrong
because we can free resources taken up by the vfs as soon as the
external reference count (now fd_usage) is zero. The internal
reference count (ino_usage) mustn't matter because the vfs has to
clean up itself in the correct order.
* vfs/direntry.c (vfs_s_new_inode): Moved initialization of st_ino
and st_dev from vfs_s_default_stat.
(vfs_s_default_stat): initialize st_ino and st_dev to zero
* vfs/tar.c (tar_open_archive): Make a new MEDATA->rdev for every
new archive.
* fish.c (FISH_OP): changed snprintf to g_snprintf, as glib is
used anyway.
* xdirentry.h (LINK_NO_FOLLOW):
* tar.c (read_header):
* direntry.c (vfs_s_resolve_symlink):
(vfs_s_inode_from_path):
(vfs_s_open): renamed NO_FOLLOW and FOLLOW to LINK_NO_FOLLOW and
LINK_FOLLOW resp. to avoid problems on solaris, where FOLLOW and
NO_FOLLOW are defined in an enum.
* vfs.h (ELAST): define it to 300, if not already defined, thats a
bad hack, but what can we do....