From 14877a49e0da182c753b66955af089a1d74e8f0a Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 12 Aug 2017 13:35:22 +0200 Subject: [PATCH] [misc] Replace m_realpath with realpath from stdlib.h --- src/httpd.c | 2 +- src/library/filescanner.c | 2 +- src/misc.c | 21 --------------------- src/misc.h | 3 --- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/httpd.c b/src/httpd.c index b165270e..d5dd2d5f 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -1006,7 +1006,7 @@ serve_file(struct evhttp_request *req, char *uri) } else if (S_ISLNK(sb.st_mode)) { - deref = m_realpath(path); + deref = realpath(path, NULL); if (!deref) { DPRINTF(E_LOG, L_HTTPD, "Could not dereference %s: %s\n", path, strerror(errno)); diff --git a/src/library/filescanner.c b/src/library/filescanner.c index 858b798d..de3f4abf 100644 --- a/src/library/filescanner.c +++ b/src/library/filescanner.c @@ -895,7 +895,7 @@ bulk_scan(int flags) parent_id = process_parent_directories(path); - deref = m_realpath(path); + deref = realpath(path, NULL); if (!deref) { DPRINTF(E_LOG, L_SCAN, "Skipping library directory %s, could not dereference: %s\n", path, strerror(errno)); diff --git a/src/misc.c b/src/misc.c index aa1e77bf..56fde219 100644 --- a/src/misc.c +++ b/src/misc.c @@ -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 ** m_readfile(const char *path, int num_lines) { diff --git a/src/misc.h b/src/misc.h index 210748c5..ac9cf488 100644 --- a/src/misc.h +++ b/src/misc.h @@ -77,9 +77,6 @@ void keyval_sort(struct keyval *kv); -char * -m_realpath(const char *pathname); - char ** m_readfile(const char *path, int num_lines);