* 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.
Этот коммит содержится в:
родитель
c44a4a4c31
Коммит
e04694309c
10
vfs/extfs.c
10
vfs/extfs.c
@ -974,13 +974,13 @@ static int extfs_fstat (void *data, struct stat *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
extfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
extfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
char *q;
|
char *q;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct entry *entry;
|
struct entry *entry;
|
||||||
char *mpath = g_strdup(path);
|
char *mpath = g_strdup (path);
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||||
@ -993,8 +993,10 @@ extfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
len = strlen (entry->inode->linkname);
|
len = strlen (entry->inode->linkname);
|
||||||
result = len > (size - 1) ? size - 1 : len;
|
if (size < len)
|
||||||
g_strlcpy (buf, entry->inode->linkname, result + 1);
|
len = size;
|
||||||
|
/* readlink() does not append a NUL character to buf */
|
||||||
|
memcpy (buf, entry->inode->linkname, result = len);
|
||||||
cleanup:
|
cleanup:
|
||||||
g_free (mpath);
|
g_free (mpath);
|
||||||
return result;
|
return result;
|
||||||
|
@ -1669,7 +1669,8 @@ ftpfs_fill_names (struct vfs_class *me, fill_names_f func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char buffer[BUF_MEDIUM];
|
static char buffer[BUF_MEDIUM];
|
||||||
static char *netrc, *netrcp;
|
static char *netrc;
|
||||||
|
static const char *netrcp;
|
||||||
|
|
||||||
/* This should match the keywords[] array below */
|
/* This should match the keywords[] array below */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -410,7 +410,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive,
|
|||||||
char *bp, *data;
|
char *bp, *data;
|
||||||
int size, written;
|
int size, written;
|
||||||
|
|
||||||
if (h_size > MC_MAXPATHLEN) {
|
if (*h_size > MC_MAXPATHLEN) {
|
||||||
message (1, MSG_ERROR, _("Inconsistent tar archive"));
|
message (1, MSG_ERROR, _("Inconsistent tar archive"));
|
||||||
return STATUS_BADCHECKSUM;
|
return STATUS_BADCHECKSUM;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ struct vfs_class {
|
|||||||
struct utimbuf * times);
|
struct utimbuf * times);
|
||||||
|
|
||||||
int (*readlink) (struct vfs_class *me, const char *path, char *buf,
|
int (*readlink) (struct vfs_class *me, const char *path, char *buf,
|
||||||
int size);
|
size_t size);
|
||||||
int (*symlink) (struct vfs_class *me, const char *n1, const char *n2);
|
int (*symlink) (struct vfs_class *me, const char *n1, const char *n2);
|
||||||
int (*link) (struct vfs_class *me, const char *p1, const char *p2);
|
int (*link) (struct vfs_class *me, const char *p1, const char *p2);
|
||||||
int (*unlink) (struct vfs_class *me, const char *path);
|
int (*unlink) (struct vfs_class *me, const char *path);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user