mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Merge branch '2787_relative_symlink_crash'
* 2787_relative_symlink_crash: Ticket #2787: crash when creating relative symlink.
This commit is contained in:
commit
7974c5b615
@ -112,14 +112,14 @@ is_8bit_printable (unsigned char c)
|
|||||||
static char *
|
static char *
|
||||||
resolve_symlinks (const vfs_path_t *vpath)
|
resolve_symlinks (const vfs_path_t *vpath)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p, *p2;
|
||||||
char *buf, *buf2, *q, *r, c;
|
char *buf, *buf2, *q, *r, c;
|
||||||
struct stat mybuf;
|
struct stat mybuf;
|
||||||
|
|
||||||
if (vpath->relative)
|
if (vpath->relative)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = vfs_path_to_str (vpath);
|
p = p2 = vfs_path_to_str (vpath);
|
||||||
r = buf = g_malloc (MC_MAXPATHLEN);
|
r = buf = g_malloc (MC_MAXPATHLEN);
|
||||||
buf2 = g_malloc (MC_MAXPATHLEN);
|
buf2 = g_malloc (MC_MAXPATHLEN);
|
||||||
*r++ = PATH_SEP;
|
*r++ = PATH_SEP;
|
||||||
@ -181,7 +181,7 @@ resolve_symlinks (const vfs_path_t *vpath)
|
|||||||
|
|
||||||
ret:
|
ret:
|
||||||
g_free (buf2);
|
g_free (buf2);
|
||||||
g_free (p);
|
g_free (p2);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user