diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 6eb0ef0a1..a3eff8d8c 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Roland Illig + + * vfs.c (_vfs_get_class): Reverted my last patch because + Leonard reported it to make mc crash. + 2004-09-25 Roland Illig * ftpfs.c (ftpfs_find_machine): Added const qualifier. diff --git a/vfs/vfs.c b/vfs/vfs.c index bc21cfd39..20819b084 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -150,7 +150,7 @@ vfs_register_class (struct vfs_class *vfs) /* Return VFS class for the given prefix */ static struct vfs_class * -vfs_prefix_to_class (const char *prefix, size_t prefix_len) +vfs_prefix_to_class (char *prefix) { struct vfs_class *vfs; @@ -161,7 +161,7 @@ vfs_prefix_to_class (const char *prefix, size_t prefix_len) return vfs; } if (vfs->prefix - && !strncmp (prefix, vfs->prefix, prefix_len)) + && !strncmp (prefix, vfs->prefix, strlen (vfs->prefix))) return vfs; } return NULL; @@ -243,7 +243,7 @@ vfs_split (char *path, char **inpath, char **op) if (slash) *slash = 0; - if ((ret = vfs_prefix_to_class (semi+1, strlen (semi+1)))){ + if ((ret = vfs_prefix_to_class (semi+1))){ if (op) *op = semi + 1; if (inpath) @@ -262,8 +262,8 @@ vfs_split (char *path, char **inpath, char **op) static struct vfs_class * _vfs_get_class (const char *path) { - const char *semi; - const char *slash; + char *semi; + char *slash; struct vfs_class *ret; g_return_val_if_fail(path, NULL); @@ -273,14 +273,18 @@ _vfs_get_class (const char *path) return NULL; slash = strchr (semi, PATH_SEP); - if (slash == NULL) - slash = semi + strlen (semi); + *semi = 0; + if (slash) + *slash = 0; - ret = vfs_prefix_to_class (semi+1, slash - (semi + 1)); + ret = vfs_prefix_to_class (semi+1); + if (slash) + *slash = PATH_SEP; if (!ret) ret = _vfs_get_class (path); + *semi = '#'; return ret; }