libpkgconf: path: pkgconf_path_relocate(): implement realpath backend
parent
0315832285
commit
fa927fd379
|
@ -240,7 +240,7 @@ pkgconf_path_free(pkgconf_list_t *dirlist)
|
|||
bool
|
||||
pkgconf_path_relocate(char *buf, size_t buflen)
|
||||
{
|
||||
#ifdef HAVE_CYGWIN_CONV_PATH
|
||||
#if defined(HAVE_CYGWIN_CONV_PATH)
|
||||
ssize_t size;
|
||||
char *tmpbuf, *ti;
|
||||
|
||||
|
@ -261,6 +261,21 @@ pkgconf_path_relocate(char *buf, size_t buflen)
|
|||
if (*ti == '\\')
|
||||
*ti = '/';
|
||||
}
|
||||
#elif defined(HAVE_REALPATH)
|
||||
char *tmpbuf;
|
||||
|
||||
if ((tmpbuf = realpath(buf, NULL)) != NULL)
|
||||
{
|
||||
size_t tmpbuflen = strlen(tmpbuf);
|
||||
if (tmpbuflen > buflen)
|
||||
{
|
||||
free(tmpbuf);
|
||||
return false;
|
||||
}
|
||||
|
||||
pkgconf_strlcpy(buf, tmpbuf, buflen);
|
||||
free(tmpbuf);
|
||||
}
|
||||
#else
|
||||
(void) buf;
|
||||
(void) buflen;
|
||||
|
|
Loading…
Reference in New Issue