From f85fa927c843c2bcc546a76bdb843c00ba4a912c Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 24 Jan 2010 10:54:52 +0100 Subject: [PATCH] Dereference library directories before processing The filescanner dereferences symlinks as it encounters them, but it did not dereference the top-level library directories given in the config. Also the playlist scanner always dereferences the filenames. As a result, there was a mismatch between the paths in the files table and the paths in the playlistitems table if the library directory given in the config contain a symlink somewhere along the way. --- src/filescanner.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/filescanner.c b/src/filescanner.c index 3cc71645..bdaee39d 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -615,6 +615,7 @@ bulk_scan(void) int nlib; int ndirs; char *path; + char *deref; time_t start; int i; int j; @@ -634,7 +635,17 @@ bulk_scan(void) { path = cfg_getnstr(lib, "directories", j); - process_directories(i, path, F_SCAN_BULK); + deref = m_realpath(path); + if (!deref) + { + DPRINTF(E_LOG, L_SCAN, "Skipping library directory %s, could not dereference: %s\n", path, strerror(errno)); + + continue; + } + + process_directories(i, deref, F_SCAN_BULK); + + free(deref); if (scan_exit) return;