Commit Graph

138 Commits

Author SHA1 Message Date
Pavel Roskin edce41facd * utilvfs.c (vfs_mkstemps): New function - create temporary file
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.
2003-10-29 00:50:36 +00:00
Pavel Roskin 77bcdc8127 * vfs.c (mc_ungetlocalcopy): Free local path here, not in class
implementations.
* vfs.h (struct vfs_s_class): Constify "local" argument for
ungetlocalcopy.  Adjust all implementations.
2003-10-28 21:52:06 +00:00
Pavel Roskin bb184c9c8b Typo in the last commit. 2003-10-28 08:47:04 +00:00
Pavel Roskin 67cd859ea3 * direntry.c (vfs_s_init_class): Use our getlocalcopy for remote
filesystems that cache files, not for archives.
(vfs_s_getlocalcopy): Corresponding changes.
2003-10-28 08:20:30 +00:00
Pavel Roskin 8e3a0c9d65 * direntry.c (vfs_s_init_class): Improve interface to allow more
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.
2003-10-28 07:09:39 +00:00
Pavel Roskin 7d16d65e35 * vfs.h: Constify some arguments for many functions.
* xdirentry.h: Likewise.  Adjust all dependencies.
2003-10-28 02:10:33 +00:00
Pavel Roskin bc455d5840 * direntry.c (vfs_s_find_inode): Only allow search from root.
Change second argument to superblock to prevent abuse.
2003-10-27 03:09:40 +00:00
Pavel Roskin ad670bade6 * direntry.c (vfs_s_find_entry_tree): Eliminate buffer of fixed
size.  Don't prepare path for vfs_s_resolve_symlink().
(vfs_s_resolve_symlink): Remove unused argument "path".
2003-10-27 02:54:59 +00:00
Pavel Roskin 511321bcfd * direntry.c (vfs_s_add_dots): Remove. Fix all callers.
(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>
2003-10-27 01:26:18 +00:00
Pavel Roskin 211ce16fac * wtools.c: Merge mc_message() and message() into one background
safe function message().  Fix all callers.
2003-10-26 04:47:20 +00:00
Pavel Roskin 50045218ab Remove unneeded includes in ../src 2003-10-25 21:34:57 +00:00
Pavel Roskin 2d33b5047e * background.c: Replace all message stubs with a new function
mc_message().  Protect against strlen(MSG_ERROR).  Adjust all
dependencies.
2003-10-25 19:54:24 +00:00
Pavel Roskin 274a5a1c41 * direntry.c (vfs_s_find_entry_tree): Canonicalize path. 2003-10-17 03:25:43 +00:00
Pavel Roskin e09739368e * direntry.c (vfs_s_resolve_symlink): Don't use buffers of fixed
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).
2003-10-16 23:58:43 +00:00
Pavel Roskin 7c4fc715da * direntry.c (vfs_s_setctl): Implement VFS_SETCTL_FLUSH.
* ftpfs.c: Remove ftpfs_flushdir.  Use MEDATA->flush.
* fish.c: Use MEDATA->flush.
2003-10-16 18:51:41 +00:00
Pavel Roskin e9ffcceae5 * direntry.c (vfs_s_setctl): Add support to VFS_SETCTL_LOGFILE.
* ftpfs.c (ftpfs_set_debug): Remove.
2003-10-16 17:08:38 +00:00
Pavel Roskin 52844a3092 * vfs.h: Rename commands for mc_ctl() and mc_setctl() to make it
clear which function they are used with.
* vfs.c (mc_ctl): Change last argument to (void*).
(mc_set): Likewise.
Adjust all dependencies.
2003-10-16 16:12:19 +00:00
Pavel Roskin fc7267906f * xdirentry.h: Move system includes to the files that need them. 2003-10-16 08:47:33 +00:00
Pavel Roskin 426c1836d5 * vfs.h: Remove all references to seekdir and telldir. Adjust
all dependencies.
2003-10-14 22:24:26 +00:00
Pavel Roskin 6cf97f4069 * xdirentry.h: Remove all typedefs, there is no need to hide the
fact that structures are structures.  Fix all dependencies.
2003-10-12 01:00:44 +00:00
Pavel Roskin 00b57fd4bf * vfs.h: Remove typedef vfs, it's too ambiguous. Massive
changes to use struct vfs_class instead.
2003-10-12 00:24:00 +00:00
Pavel Roskin 6e6fd9b352 * vfs.c (vfs_add_noncurrent_stamps): Call vfs_rm_parents() at
the end.  Change all callers not to call it.
(vfs_rm_parents): Make static.
2003-10-11 17:30:54 +00:00
Pavel Roskin 3fb8e46501 * direntry.c: Don't use vfs_local_fs directly, use VFSF_LOCAL.
* extfs.c: Likewise.
* vfs.c (vfs_addstamp): Likewise.
(vfs_init): Register vfs_local_fs like other classes.
2003-10-11 16:54:46 +00:00
Pavel Roskin 523589cddc * direntry.c: Make more functions static. They are filled in in
vfs_s_init_class() now and don't need to be exported.
2003-10-11 10:13:36 +00:00
Pavel Roskin 091023c37a * undelfs.c (undelfs_get_path): Constify first argument.
* vfs.h (struct vfs_class): Constify path.  Fix all dependencies.
2003-10-11 07:20:53 +00:00
Pavel Roskin 9d1f2aae71 * vfs.c (vfs_type): Rename to vfs_get_class(). Fix prototype to
avoid using internal vfs type.  Adjust all dependencies.
(vfs_rosplit): Rename to _vfs_get_class().
2003-10-11 06:25:29 +00:00
Pavel Roskin 413f8cbabd * fish.c: Convert to calling vfs_register_class().
* fish.h: Eliminate.  Adjust all dependencies.
* direntry.c (vfs_s_init_class): Add missing vfs_s_setctl().
2003-10-10 23:38:03 +00:00
Pavel Roskin b2edfddd7e * vfs.h: Rename "struct _vfs" to "struct vfs_class". Allow
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.
2003-10-10 23:13:09 +00:00
Pavel Roskin b1aba35e22 * direntry.c: Make functions static when possible.
* xdirentry.h: Remove unneeded declarations.
2003-10-07 22:38:28 +00:00
Pavel Roskin 94e14aacfb * direntry.c (vfs_s_dump): Commented out.
* 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.
2003-08-29 22:48:25 +00:00
Andrew V. Samoilov 55ccd00c73 * direntry.c (vfs_s_dump): SunOS 5.8 warning fix. Reformat function. 2003-02-19 14:04:35 +00:00
Pavel Roskin f2c028ce46 s/can not/cannot/ 2002-12-26 02:21:37 +00:00
Pavel Roskin ddf2ad1612 * direntry.c (vfs_s_open): If the filesystem is read-only,
disable file creation.
2002-12-25 04:57:26 +00:00
Pavel Roskin 1b2f7e7d13 s/Dir cache/Directory cache/
"Dir cache" should be in geek.po :-)
2002-12-16 06:04:02 +00:00
Pavel Roskin 416008fc74 * direntry.c (vfs_s_resolve_symlink): Use g_snprintf() instead
of non-portable snprintf().
Reported by Xu Qiang <Xu.Qiang@xssc.sgp.xerox.com>
2002-10-07 05:32:45 +00:00
Pavel Roskin 99800b2f24 * direntry.c (vfs_s_retrieve_file): Allow interrupt by Ctrl-C.
From Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
2002-09-29 18:35:14 +00:00
Pavel Roskin da7e82d253 Global removal of RCS Id: flags. 2002-09-26 23:13:45 +00:00
Pavel Roskin 04c7da6358 * direntry.c [!USE_NETCODE]: Disable functions used in networked
filesystems only.
2002-09-06 01:34:12 +00:00
Pavel Roskin 1c411834a8 * direntry.c (vfs_s_get_line): Fix off-by-one buffer overflow. 2002-08-20 01:08:34 +00:00
Pavel Roskin 7f923cc9c0 * direntry.c (vfs_s_getlocalcopy): Fix potentially dangerous
strcpy().
2002-08-15 21:31:54 +00:00
Pavel Roskin cf8ab0de99 * extfs.c (s_readdir): Simplify.
* direntry.c (vfs_s_readdir): Use vfs_dirent.
* mcfs.c (mcfs_readdir): Likewise.
* smbfs.c (smbfs_readdir): Likewise.
* undelfs.c (undelfs_readdir): Use vfs_dirent and
compute_namelen().
2002-08-15 21:15:17 +00:00
Pavel Roskin 8b8d7de7ca * direntry.c (vfs_s_readdir): Use compute_namelen().
* extfs.c (s_readdir): Likewise.
* mcfs.c (mcfs_readdir): Likewise.
* smbfs.c (smbfs_readdir): Likewise.
2002-08-15 19:38:17 +00:00
Pavel Roskin e66ab47cf1 * direntry.c (vfs_s_find_entry_linear): Canonicalize path before searching 2002-07-26 21:58:43 +00:00
Pavel Roskin 982a256ee0 * xdirentry.h: Get rid of ifree(), it's equivalent to g_free().
* direntry.c: Likewise.
* fish.c: Likewise.
* ftpfs.c: Likewise.
2002-07-19 16:04:27 +00:00
Pavel Roskin 6f3a7c8029 * direntry.c (vfs_s_open): Don't pass O_LINEAR to open() -
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>
2002-07-10 17:56:27 +00:00
Andrew V. Samoilov a60f38583a * xdirentry.h (vfs_s_fh.u.ftp): Add append field.
(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.
2002-05-22 17:19:24 +00:00
Andrew V. Samoilov 12ba0fc8a4 * direntry.c (vfs_s_retrieve_file): Please, care about
fish.local_stat ...
* fish.c (linear_close): ... here.
2002-05-21 17:27:30 +00:00
Andrew V. Samoilov a844c07aac * direntry.c (vfs_s_read): Move MEDATA->linear_start() ...
* (vfs_s_open): ... here.
2002-05-17 07:08:03 +00:00
Andrew V. Samoilov 7df53e2bd2 * direntry.c (vfs_s_resolve_symlink): Comment out buggy code.
(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.
2002-03-06 08:46:35 +00:00
Andrew V. Samoilov 1711c0ab8b * direntry.c (vfs_s_retrieve_file): Use off_t for total
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.
2002-02-08 09:42:38 +00:00
Pavel Roskin 0b36c6e5eb * direntry.c (vfs_s_free_super): Remove i18n on commented out
developer-only code.
2001-08-16 22:23:05 +00:00
Pavel Roskin 680f3f7ed2 * cpio.c: Include <config.h> before everything else.
* 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.
2001-06-25 21:34:46 +00:00
Pavel Roskin 5da3b42969 * ftpfs.c: Declare functions without declarations static. Don't
omit `void' in declarations.
* cpio.c: Likewise.
* direntry.c: Likewise.
* extfs.c: Likewise.
* mcfs.c: Likewise.
* tar.c: Likewise.
* vfs.c: Likewise.
* vfs.h: Likewise.
* mcserv.c: Likewise. Remove unused functions.
2001-06-14 20:08:27 +00:00
Pavel Roskin bea09b932d * src/ext.c (exec_extension): Use mc_mkstemps().
* 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().
2001-05-21 16:21:07 +00:00
Pavel Machek 55e56a1426 Fixes from Roland: we may not g_free() strdup-ed text. 2000-10-31 15:43:49 +00:00
Pavel Machek 7d50be2f1c Do not leave st_nlink uninitialized. 2000-05-10 10:19:00 +00:00
Pavel Machek 8542ae3328 Fixed problems with stating / of ftp archive; minor bugfix. 2000-05-03 19:10:52 +00:00
Pavel Machek d91a2b9a63 2000-04-28 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* direntry.c (vfs_s_internal_stat): added ugly special case for /
        of archive to always exist. It seems I'm hiding some underlying
        problem :-(.
2000-04-28 07:56:30 +00:00
Pavel Machek d7bf5305b1 2000-04-26 Andrew V. Samoilov <sav@bcs.zp.ua>
* 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
2000-04-28 07:43:13 +00:00
Pavel Machek a1225de8b3 Fix problems with stating / of ftp server + NO_LOCALHASH to prevent
podfuk deadlocs
2000-04-16 19:13:00 +00:00
Pavel Machek 425dbd07c1 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-05 13:08:42 +00:00
Pavel Machek aa6cbcbc89 2000-01-31 Andrew V. Samoilov <sav@bcs.zp.ua>
* direntry.c: (vfs_s_resolve_symlink, vfs_s_readlink) fixed segfaults
	for broken symlinks like 2001 -> The Space Oddysea.
2000-01-31 13:48:00 +00:00
Pavel Machek 28eb60242d ftpfs can not handle homes nicely. Is there good way to solve this? 2000-01-24 12:35:52 +00:00
Pavel Machek 748e4c38f9 1999-12-15 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* Merged changes by Andrew V. Samoilov <sav@bcs.zp.ua>. They are
	mostly internationalization + fixing stupid bugs of mine
1999-12-16 12:55:16 +00:00
Pavel Machek bcfd532240 1999-12-08 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* 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.
1999-12-08 11:39:14 +00:00
Pavel Machek a0878908e1 1999-02-17 Pavel Machek <pavel@bug.ucw.cz>
* direntry.c (vfs_s_getlocalcopy): fixed segfault, getlocalcopy's
	name has to be malloced.
1999-11-03 14:51:22 +00:00
Norbert Warmuth d988df6100 1999-08-18 Norbert Warmuth <nwarmuth@privat.circular.de>
* 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.).
1999-08-18 19:08:56 +00:00
Miguel de Icaza 7ca0948527 OS/2 portability changes by Ilya 1999-02-13 21:39:18 +00:00
Timur Bakeyev e57da1f7b3 Glibing....
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.
1999-01-27 00:49:11 +00:00
Timur Bakeyev bf81009392 Actually commit all my changers. Fear :> 1999-01-20 22:01:11 +00:00
Miguel de Icaza a89cb1c50a Make the code compile, take 2 1999-01-17 23:10:53 +00:00
Miguel de Icaza 3eb8325e67 Make the code compile.
Reindent
1999-01-17 23:10:05 +00:00
Paul Sheer fa40fbcafa more fixes to resolve symlinks 1999-01-17 12:33:45 +00:00
Paul Sheer ff2b951de7 vfs_s_find_entry_tree() does not actually follow symlinks - fixed 1999-01-17 11:46:42 +00:00
Paul Sheer e035287a51 vfs_s_resolve_symlink(): convert absolute linknames to relative linkname with some leading ../ 1999-01-17 10:07:37 +00:00
Miguel de Icaza 85f17a4dc6 Lots of changes:
- 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
1999-01-11 00:48:23 +00:00
Miguel de Icaza 8f2327ecdb 1999-01-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gmetadata.c (gmeta_get_icon_pos): Fixed the memory leak here.

	* gicon.c (gicon_get_icon_for_file): Actually return a value
	here.

Editor fixes, vfs warning fixes;
1999-01-02 07:46:20 +00:00
Norbert Warmuth e4c8a9d060 Thu Dec 31 08:47:15 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* 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.
1998-12-31 15:54:49 +00:00
Norbert Warmuth d2b1a29c91 Fri Dec 25 21:48:51 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* 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.
1998-12-28 10:27:07 +00:00
Pavel Machek 3e1a72d64d Some fixes in src/ part (want_stale_data is now done right) and more
daring code in vfs/ (errors are now reported instead of silently
ignored)
1998-12-09 20:22:53 +00:00
Miguel de Icaza 301e7fbfc3 Many changes:
- Beginning of the CORBA support for the file manager.
	- Tk and XView code dropped.

Miguel
1998-12-02 23:44:06 +00:00
Sebastian Wilhelmi 8b8a943b6e 1998-12-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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....
1998-12-02 13:17:24 +00:00
Sung-Hyun Nam af1a952ea0 * direntry.c (vfs_s_new_super): Added the missing return value. 1998-12-02 05:11:48 +00:00
Pavel Machek 4029fef2f3 Small bugfixes, killing of debuging hacks that escaped me. 1998-11-22 16:17:42 +00:00
Pavel Machek 4706638b22 Big merge: fish now uses proper caching, small fixes almost
everywhere. I hope I did not break it too much.
1998-11-21 19:36:01 +00:00
Pavel Machek 226c2fcc4d Bugfixes 1998-10-28 16:07:55 +00:00
Miguel de Icaza c8a8394f56 Make it compile 1998-10-23 20:18:48 +00:00
Pavel Machek 37e364fe67 BIG changes: tar now uses brand-new direntry.c. Hope it does not hurt
too much.
1998-10-23 08:26:25 +00:00