* 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.
This commit is contained in:
Andrew V. Samoilov 2004-09-02 14:12:21 +00:00
parent e04694309c
commit fc3bf048e9
5 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,17 @@
2004-09-02 Andrew V. Samoilov <sav@bcs.zp.ua>
* tar.c (tar_read_header): Fix missed *.
* extfs.c (extfs_readlink): Revert last change: readlink does not
append a NUL character to buf.
* ftpfs.c: Warning fix.
* vfs-impl.h (struct vfs_class.readlink): Make "size" size_t.
Adjust all callers.
* 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 Roland Illig <roland.illig@gmx.de>
* mcfs.c (mcfs_readlink): Fixed syntax error (usage of

View File

@ -672,9 +672,10 @@ vfs_s_fstat (void *fh, struct stat *buf)
}
static int
vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, int size)
vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
{
struct vfs_s_inode *ino;
size_t len;
ino = vfs_s_inode_from_path (me, path, 0);
if (!ino)
@ -686,8 +687,12 @@ vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, int size)
if (ino->linkname == NULL)
ERRNOR (EFAULT, -1);
g_strlcpy (buf, ino->linkname, size);
return strlen (buf);
len = strlen (buf);
if (size < len)
len = size;
/* readlink() does not append a NUL character to buf */
memcpy (buf, ino->linkname, len);
return len;
}
static void *

View File

@ -147,7 +147,7 @@ local_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
}
static int
local_readlink (struct vfs_class *me, const char *path, char *buf, int size)
local_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
{
return readlink (path, buf, size);
}

View File

@ -235,7 +235,8 @@ static int sfs_utime (struct vfs_class *me, const char *path, struct utimbuf *ti
return utime (path, times);
}
static int sfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
static int
sfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
{
path = sfs_redirect (me, path);
return readlink (path, buf, size);

View File

@ -856,9 +856,11 @@ smbfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
}
static int
smbfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
smbfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
{
DEBUG(3, ("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf, size));
DEBUG (3,
("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf,
(int) size));
my_errno = EOPNOTSUPP;
return -1; /* no symlinks on smb filesystem? */
}