Merge pull request #413 from chme/realpath

[misc] Replace m_realpath with realpath from stdlib.h
This commit is contained in:
ejurgensen 2017-08-12 21:52:30 +02:00 committed by GitHub
commit 2d3d641f41
4 changed files with 2 additions and 26 deletions

View File

@ -1006,7 +1006,7 @@ serve_file(struct evhttp_request *req, char *uri)
} }
else if (S_ISLNK(sb.st_mode)) else if (S_ISLNK(sb.st_mode))
{ {
deref = m_realpath(path); deref = realpath(path, NULL);
if (!deref) if (!deref)
{ {
DPRINTF(E_LOG, L_HTTPD, "Could not dereference %s: %s\n", path, strerror(errno)); DPRINTF(E_LOG, L_HTTPD, "Could not dereference %s: %s\n", path, strerror(errno));

View File

@ -909,7 +909,7 @@ bulk_scan(int flags)
parent_id = process_parent_directories(path); parent_id = process_parent_directories(path);
deref = m_realpath(path); deref = realpath(path, NULL);
if (!deref) if (!deref)
{ {
DPRINTF(E_LOG, L_SCAN, "Skipping library directory %s, could not dereference: %s\n", path, strerror(errno)); DPRINTF(E_LOG, L_SCAN, "Skipping library directory %s, could not dereference: %s\n", path, strerror(errno));

View File

@ -512,27 +512,6 @@ keyval_sort(struct keyval *kv)
} }
char *
m_realpath(const char *pathname)
{
char buf[PATH_MAX];
char *ret;
ret = realpath(pathname, buf);
if (!ret)
return NULL;
ret = strdup(buf);
if (!ret)
{
DPRINTF(E_LOG, L_MISC, "Out of memory for realpath\n");
return NULL;
}
return ret;
}
char ** char **
m_readfile(const char *path, int num_lines) m_readfile(const char *path, int num_lines)
{ {

View File

@ -77,9 +77,6 @@ void
keyval_sort(struct keyval *kv); keyval_sort(struct keyval *kv);
char *
m_realpath(const char *pathname);
char ** char **
m_readfile(const char *path, int num_lines); m_readfile(const char *path, int num_lines);