* direntry.c (vfs_s_resolve_symlink): Use g_snprintf() instead
of non-portable snprintf(). Reported by Xu Qiang <Xu.Qiang@xssc.sgp.xerox.com>
Этот коммит содержится в:
родитель
9acd93fe1e
Коммит
416008fc74
@ -1,3 +1,9 @@
|
|||||||
|
2002-10-07 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* 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-04 Pavel Roskin <proski@gnu.org>
|
2002-10-04 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* mcfs.c (mcfs_lseek): Explicity cast offset to int. This fixes
|
* mcfs.c (mcfs_lseek): Explicity cast offset to int. This fixes
|
||||||
|
@ -340,8 +340,6 @@ vfs_s_find_inode (vfs *me, vfs_s_inode *root, char *path, int follow, int flags)
|
|||||||
return ent->ino;
|
return ent->ino;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ouch - vfs_s_resolve symlink does not work for filesystems like ftp & fish:
|
|
||||||
you may not lookup with some other root! */
|
|
||||||
vfs_s_entry *
|
vfs_s_entry *
|
||||||
vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
|
vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
|
||||||
{
|
{
|
||||||
@ -362,25 +360,29 @@ vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
|
|||||||
ERRNOR (EFAULT, NULL);
|
ERRNOR (EFAULT, NULL);
|
||||||
|
|
||||||
if (MEDATA->find_entry == vfs_s_find_entry_linear) {
|
if (MEDATA->find_entry == vfs_s_find_entry_linear) {
|
||||||
if (*linkname == PATH_SEP)
|
if (*linkname == PATH_SEP)
|
||||||
return (MEDATA->find_entry) (me, entry->dir->super->root, linkname, follow - 1, 0);
|
return (MEDATA->find_entry) (me, entry->dir->super->root,
|
||||||
else { /* FIXME: this does not work */
|
linkname, follow - 1, 0);
|
||||||
char *fullpath = vfs_s_fullpath(me, entry->dir);
|
else {
|
||||||
snprintf(buf, sizeof (buf), "%s/%s", fullpath, linkname);
|
char *fullpath = vfs_s_fullpath (me, entry->dir);
|
||||||
|
|
||||||
|
g_snprintf (buf, sizeof (buf), "%s/%s", fullpath, linkname);
|
||||||
g_free (fullpath);
|
g_free (fullpath);
|
||||||
return (MEDATA->find_entry) (me, entry->dir->super->root, buf, follow - 1, 0);
|
return (MEDATA->find_entry) (me, entry->dir->super->root, buf,
|
||||||
|
follow - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert absolute paths to relative ones */
|
/* Convert absolute paths to relative ones */
|
||||||
if (*linkname == PATH_SEP) {
|
if (*linkname == PATH_SEP) {
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
for (p = path, q = entry->ino->linkname; *p == *q; p++, q++);
|
for (p = path, q = entry->ino->linkname; *p == *q; p++, q++);
|
||||||
while (*(--q) != PATH_SEP);
|
while (*(--q) != PATH_SEP);
|
||||||
q++;
|
q++;
|
||||||
for (;; p++){
|
for (;; p++) {
|
||||||
p = strchr (p, PATH_SEP);
|
p = strchr (p, PATH_SEP);
|
||||||
if (!p){
|
if (!p) {
|
||||||
strcat (buf, q);
|
strcat (buf, q);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user