tilde-bug in vfs.c
- From: Oskar Liljeblad <oskar osk mine nu>
- To: mc-devel gnome org
- Subject: tilde-bug in vfs.c
- Date: Thu, 5 Sep 2002 21:40:58 +0200
Hello
There is a bug which makes mc display regular file named '~root'
(or '~<someaccount>') as a directory. It is mentioned at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=66591&repeatmerged=yes
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=61202&repeatmerged=yes
The problem is in vfs_canon in vfs/vfs.c. This patch is a bit
crude, but it works. I don't know of a better solution unless you
intend to replace all calls of vfs_canon with something else.
Oskar Liljeblad (oskar osk mine nu)
PS. There's no bug tracker for MC right? DS.
--- vfs/vfs.c.orig 2002-09-05 21:02:47.000000000 +0200
+++ vfs/vfs.c 2002-09-05 21:18:51.000000000 +0200
@@ -720,31 +720,31 @@
#define ISSLASH(a) (!a || (a == '/'))
-char *
-vfs_canon (const char *path)
+static char *
+vfs_canon_internal (const char *path, int allow_tilde)
{
if (!path)
vfs_die("Cannot canonicalize NULL");
/* Tilde expansion */
- if (*path == '~'){
+ if (allow_tilde && *path == '~'){
char *local, *result;
local = tilde_expand (path);
if (local){
- result = vfs_canon (local);
+ result = vfs_canon_internal (local, allow_tilde);
g_free (local);
return result;
}
}
/* Relative to current directory */
- if (*path != PATH_SEP){
+ if (*path != PATH_SEP){
char *local, *result;
local = concat_dir_and_file (current_dir, path);
- result = vfs_canon (local);
+ result = vfs_canon_internal (local, allow_tilde);
g_free (local);
return result;
}
@@ -760,6 +760,24 @@
}
}
+char *
+vfs_canon (const char *path)
+{
+ char *canon;
+ vfs *vfs;
+ struct stat buf;
+
+ canon = vfs_canon_internal(path, 0);
+
+ vfs = vfs_type (canon);
+ if (vfs->stat && (*vfs->stat) (vfs, vfs_name (canon), &buf) != -1){
+ return canon;
+ }
+ g_free (canon);
+
+ return vfs_canon_internal(path, 1);
+}
+
vfsid
vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]