Sergei Trofimovich
8abe72112a
vfs: ftp: fix build breakage on absent CANON_PATH_RMDBLDT
...
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-25 17:18:50 +02:00
Slava Zanko
4f36622725
Ticket #1828 : Improved symlink handling in ftpfs
...
Originally from: http://mail.gnome.org/archives/mc-devel/2005-April/msg00035.html
The routines `vfs_s_find_entry_linear()' and `vfs_s_find_entry_tree()'
call `canonicalize_pathname()' on entry. This routine eats `..' path
components in certain cases. In case of ftpfs this is not desired -
the path should be kept as is since the code in direntry.c doesn't have
enough knowledge of the directory structure on the remote end.
Assume that
there is a path like this on the remote server
/path1/path2/path3
The `path2' component is a symlink to some directory and `path3' is a
symlink stored in `path2' which is relative to `path2' i.e.
path2
path3 -> ../some/other/path
Now, the code in direntry.c will determine that `path3' is a symlink and
will try to resolve (vfs_s_resolve_symlink) it by passing the following path
/path1/path2/../some/other/path
to `vfs_s_find_entry_linear' . As I've said above this routine calls
`canonicalize_pathname' on entry which will modify the path like this:
/path1/some/other/path
Now this is clearly wrong since `path2' is a symlink and it should be
resolved first. In the case of ftpfs the code in direntry.c doesn't have
enough knowledge about physycal directory layout on the remote filesystem
so it shouldn't try to canonicalize the path. The path should be left as
is and passed to the remote end for processing.
Fix issue:
Changed function canonicalize_pathname (as fact, renamed to custom_canonicalize_pathname)
In this function added ability to partial canonicalize of pathname.
And some functions from vfs/direntry.c calls custom_canonicalize_pathname without
removal of '..' stuff.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-12-25 15:53:48 +02:00
Andrew Borodin
dc604d811a
The check result of g_new(), g_new0(), g_malloc(), g_malloc0() and g_realloc() is useless.
...
g_new(), g_new0(), g_malloc(), g_malloc0() and g_realloc() functions
never return NULL and call abort() on fail. So check result of these
functions is useless. g_try_new(), g_try_new0(), g_try_malloc(),
g_try_malloc0() and g_try_realloc() functions are used instead.
Some minor optimization and code formatting are also performed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-16 11:10:43 +02:00
Vit Rosin
b6875454b2
Unifying of g_strconcat() calls
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-16 11:10:43 +02:00
Andrew Borodin
698385bdd0
Ticket #1732 : cpio VFS skips empty directories in the root of archive
...
Initial step: some optimization and type accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-11-19 20:34:25 +03:00
Andrew Borodin
fb51cb8241
Use TTY function names instead of #define's.
2009-08-12 21:23:12 +04:00
Andrew Borodin
f3730bdc41
Initial step to move TTY layer of MC to separate library.
2009-08-12 21:19:20 +04:00
Slava Zanko
9ee5f318ab
Ticket #1395 (Copying to fish is broken)
...
No any files was copyed into fish.
Issue:
Files was try to create with O_EXCL flag. On fish it's fail
Now for fish flag O_EXCL will dropped.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-07-15 13:59:25 +03:00
Enrico Weigelt, metux IT service
c7d04dd47a
fixed several missing #include's
2009-06-18 21:02:29 +04:00
Sergei Trofimovich
0d281515a6
warnings fix: sanitized 'write'alike callback prototype (int retval -> ssize_t)
...
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-04-23 22:20:34 +03:00
Mikhail S. Pobolovets
0a7899709b
Simple doxygen description for files in vfs (not subdirs) directory.
...
Mostly \file and \brief tag added.
Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
2009-02-10 16:18:55 +02:00
Slava Zanko
e54f318cef
Completely removed MHL stuff
...
Changed all source files relative to remove MHL
Some string-related functions moved into src/util.c
This stable fix.
2009-02-06 14:01:28 +02:00
Patrick Winnertz
d84586ba82
Reverted the use of mhl_str_dup and use g_strdup instead.
...
Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-05 23:40:32 +01:00
Patrick Winnertz
1c287d798d
First bunch of mhl_mem_free removal patches
...
Signed-off-by: Patrick Winnertz <winnie@debian.org>
2009-02-05 23:36:58 +01:00
Enrico Weigelt, metux IT service
8b38cf44da
manully merged 227_replace_g_free
2009-02-02 22:34:05 +01:00
Enrico Weigelt, metux IT service
f921cc40cd
replaced calls to g_strdup() by mhl_str_dup()
2009-01-30 20:10:40 +01:00
Enrico Weigelt, metux IT service
15d7d47c15
replaced g_free() by mhl_mem_free()
2009-01-30 19:28:35 +01:00
Enrico Weigelt, metux IT service
5d150562aa
merged 158_message_codes branch
2009-01-24 04:53:51 +01:00
Enrico Weigelt, metux IT service
183a66f7f5
changing return types of *read() and *write() functions to ssize_t
2009-01-13 19:00:25 +01:00
Enrico Weigelt, metux IT service
154feb5160
2009-01-10 Enrico Weigelt, metux ITS <weigelt@metux.de>
...
* edit/editcmd.c:
* src/achown.c src/background.c src/boxes.c src/chmod.c:
* src/chown.c src/cmd.c src/command.c src/dir.c src/execute.c:
* src/ext.c src/file.c src/filegui.c src/find.c src/help.c:
* src/learn.c src/main.c src/panelize.c src/screen.c:
* src/selcodepage.c src/subshell.c src/tree.c src/user.c:
* src/utilunix.c src/view.c:
* vfs/cpio.c vfs/direntry.c vfs/extfs.c vfs/fish.c vfs/ftpfs.c:
* vfs/mcfs.c vfs/sfs.c vfs/smbfs.c vfs/tar.c vfs/undelfs.c:
* vfs/utilvfs.c vfs/vfs.c:
Changed message type codes on calls to message(), query_dialog(),
close_error_pipe() from numeric IDs to symbols D_ERROR, D_NORMAL
2009-01-10 14:13:56 +01:00
Pavel Tsekov
305e2aab79
* vfs/direntry.c (vfs_s_free_super): Remove redundant code.
2007-09-24 13:47:54 +00:00
Pavel Tsekov
52a724a2c8
* vfs/direntry.c (vfs_s_inode_from_path): Revert last change.
2006-03-30 13:04:50 +00:00
Pavel Tsekov
06b721a44c
* vfs/direntry.c (vfs_s_inode_from_path): Do not give up if a given path
...
does not exist in the directory cache. In such scenario use the underlying
vfs to determine whether the path exists or not.
2006-03-23 12:36:10 +00:00
Pavel Tsekov
c9f1b97869
* vfs/ftpfs.c (ftpfs_dir_uptodate): Remove.
...
(init_ftpfs): Adjust the code to reflect the removal of
`ftpfs_dir_uptodate'.
* vfs/fish.c (fish_dir_uptodate): Remove.
(init_fish): Adjust the code to reflect the removal of
`fish_dir_uptodate'.
* vfs/direntry.c (vfs_s_dir_uptodate): New function.
(vfs_s_init_class): Initialize the `dir_uptodate' field of
vfs_s_subclass.
2006-02-23 10:46:29 +00:00
Pavel Tsekov
da3b1863ab
* direntry.c (vfs_s_open): Be less restrictive when O_LINEAR is specified
...
and `linear_start' is not implemented.
2006-01-28 15:47:02 +00:00
Pavel Tsekov
c8494f41bb
* xdirentry.h (LS_LINEAR_PREOPEN): New macro definition.
...
* direntry.c (vfs_s_open): When opening a file in linear mode,
defer the actual open operation until the first read call.
(vfs_s_read): When reading in linear mode, open the file
on the first read operation.
(vfs_s_lseek): When in linear mode, make sure that seeking is
allowed only before the first read operation.
* ftpfs.c (ftpfs_ctl): Make the code aware of LS_LINEAR_PREOPEN.
* fish.c (fish_ctl): Likewise.
2006-01-25 14:04:27 +00:00
Roland Illig
7e7b81b73e
* direntry.c: Added const qualifiers to work around gcc
...
warnings.
* extfs.c: Likewise.
* fish.c: Likewise.
* ftpfs.c: Likewise.
* sfs.c: Likewise.
* xdirentry.h: Likewise.
2005-09-05 00:52:56 +00:00
Roland Illig
b4479c533d
* direntry.c: Removed an unused variable.
2005-08-15 21:25:02 +00:00
Roland Illig
a2511b792c
* dirent.c (split_dir_name): Don't assign a string literal to a
...
char *. Use '\0' instead of 0 when operating on characters.
2005-05-24 12:09:22 +00:00
Roland Illig
d7e7ec48dd
* *.c: Declared unused variables with (void) to avoid the gcc
...
warnings.
* extfs.c (extfs_get_path_mangle, extfs_get_path): Removed unused
parameter.
* ftpfs.c (ftpfs_netrc_bad_mode): Likewise.
* vfs.c (mc_def_getlocalcopy): Likewise.
2005-02-22 18:35:22 +00:00
Roland Illig
54cccec688
* utilvfs.h: Removed unneeded #includes.
...
* *.c: Added the #includes that have been removed from utilvfs.h.
* tcputil.c: Just removed the unneeded #include "utilvfs.h".
2005-02-19 16:36:38 +00:00
Andrew V. Samoilov
0fdf2a6e6d
* direntry.c (vfs_s_readlink): Correctly calculate link length.
2004-11-29 18:44:49 +00:00
Andrew V. Samoilov
09180a901a
* direntry.c (vfs_s_open): Fix memory leak.
...
(vfs_s_retrieve_file): Check write() return more carefully.
2004-11-26 12:00:36 +00:00
Andrew V. Samoilov
c060826178
* direntry.c (vfs_s_free_entry): g_free handles NULL argument too,
...
no need for the comparison.
* extfs.c (extfs_free_archive): Likewise.
(extfs_open_archive): Likewise.
(extfs_read_archive): Likewise.
(extfs_remove_entry): Likewise.
(extfs_free_entry): Likewise.
* fish.c (fish_open_archive): Likewise.
(fish_archive_same): Likewise.
* ftpfs.c (ftpfs_split_url): Likewise.
* local.c (local_closedir): Likewise.
* mcserv.c (close_handle): Likewise.
* smbfs.c (smbfs_free_bucket): Likewise.
* tar.c (tar_read_header): Likewise.
* undelfs.c (undelfs_shutdown): Likewise.
* vfs.c (vfs_shut): Likewise.
2004-09-24 23:00:18 +00:00
Roland Illig
4bc786735e
* cpio.c: Replaced NULL with (char *) NULL. Likewise for 0, where
...
NULL was meant.
* direntry.c: Likewise.
* extfs.c: Likewise.
* fish.c: Likewise.
* ftpfs.c: Likewise.
* mcfs.c: Likewise.
* tar.c: Likewise.
* undelfs.c: Likewise.
* vfs.c: Likewise.
2004-09-24 15:08:21 +00:00
Roland Illig
a3cf3b2d5f
* direntry.c (vfs_s_new_entry): see 2004-09-19. Additionally followed the advice
...
concerning g_strdup in /HACKING.
(vfs_s_generate_entry): Likewise.
(vfs_s_find_entry_linear): Likewise.
(vfs_s_find_inode): Likewise.
* xdirentry.h: Likewise.
2004-09-22 11:28:14 +00:00
Andrew V. Samoilov
c524515308
* direnty.c (vfs_s_new_entry): Revert last changes.
...
(vfs_s_generate_entry): Likewise.
(vfs_s_find_entry_linear): Likewise.
(vfs_s_find_inode): Likewise.
* xdirentry.h: likewise.
2004-09-22 05:50:45 +00:00
Roland Illig
a9f9db7b6b
* direntry.c: Added const qualifier to function declarations and
...
variables. Introduced local modifiable strings where necessary.
* xdirentry.h: likewise.
2004-09-19 16:07:17 +00:00
Andrew V. Samoilov
c9f834b501
* vfs.c (vfs_cmp_handle): Fixing warnings on on 64-bit
...
platforms.
(vfs_op):Likewise.
(vfs_info):Likewise.
(vfs_free_handle):Likewise.
* extfs/rpm (mcrpmfs_run): Quote parameters to calls
to system/open that spawn a shell.
* direntry.c (vfs_s_find_entry_tree): Make "size"
size_t.
2004-09-03 21:23:05 +00:00
Andrew V. Samoilov
fc3bf048e9
* local.c (local_readlink): Make "size" size_t.
...
* direntry.c (vfs_s_readlink): Revert last changes. Make "size"
size_t.
* sfs.c (sfs_readlink): Reformat function.
* smbfs.c (smbfs_readlink): Reformat function.
2004-09-02 14:12:21 +00:00
Andrew V. Samoilov
15c6e5cae6
* direntry.c (vfs_s_readlink): Use g_strlcpy instead strncpy.
...
* ftpfs.c (ftpfs_get_reply): Use g_strlcpy instead strncpy.
* extfs.c (extfs_readlink): Fix return value. Use g_strlcpy
instead strncpy.
* mcfs.c (mcfs_readlink): Fix return value. Use g_strlcpy
instead strncpy.
* tar.c (tar_read_header): Add additional check for consistency.
Fix memory leak.
* cpio.c (cpio_defer_find): Remove recursion.
(cpio_free_archive): Fix memory leak.
(cpio_read_bin_head): Use union for simplicity using of header
structure. Add additional check for consistency.
(cpio_read_oldc_head): Add additional check for consistency.
2004-09-02 00:09:02 +00:00
Andrew V. Samoilov
a2d1d4e8dc
* direntry.c: Use g_strlcpy instead strncpy for fix buffer overrun
...
* extfs.c: Likewise.
* mcfs.c: Likewise.
* smbfs.c: Likewise.
* utilvfs.c: Likewise.
2004-08-26 08:47:50 +00:00
Roland Illig
34a8088483
Splittet the vfs.h header into a user's part (vfs.h) and an implementor's part (vfs-impl.h).
2004-08-16 23:18:42 +00:00
Roland Illig
b17b1ac213
Const-ified the rest of the vfs_class methods.
2004-08-16 22:15:28 +00:00
Roland Illig
dc70d154db
Made the buf argument to vfs->write constant.
2004-08-16 21:16:54 +00:00
Roland Illig
789e5e9bcb
Made the path argument to vfs->[l]stat constant. Created a new memory leak, which will be fixed soon.
2004-08-16 20:26:42 +00:00
Roland Illig
db3f21b702
Added a typedef for a function. Added more const-ness to the function arguments.
2004-08-16 16:34:11 +00:00
Andrew V. Samoilov
02db8a9660
* direntry.c (vfs_s_resolve_symlink): Check vfs_s_fullpath()
...
return value to avoid NULL dereference.
Reported by wwp <subscript@free.fr>.
2004-03-07 06:12:49 +00:00
Pavel Roskin
6ffd35bf07
* gc.c: Eliminate all code for timestamping parent filesystems.
...
It's broken and undocumented. Adjust all dependencies.
2003-11-26 21:10:42 +00:00
Pavel Roskin
8ed2cc4594
* direntry.c (vfs_s_resolve_symlink): Eliminate
...
g_strdup_printf().
(vfs_s_fullpath): Likewise.
2003-11-24 20:30:30 +00:00