Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforge.net>2009-04-18 06:23:06 +0400
committerJustin Maggard <jmaggard@users.sourceforge.net>2009-04-18 06:23:06 +0400
commit2874e484607ad96ee5b3e731a990441e00fe7ff1 (patch)
tree76b91222f0d182d9c7949fd48df6d0137e67d35e /albumart.c
parent2855817d5909ce53c18ce7c51c959e2a49cbc139 (diff)
* Fix issues with album art linking if the link target is in a different directory than the previous file.
Diffstat (limited to 'albumart.c')
-rw-r--r--albumart.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/albumart.c b/albumart.c
index a797fd1..db2086b 100644
--- a/albumart.c
+++ b/albumart.c
@@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <libgen.h>
#include <setjmp.h>
+#include <errno.h>
#include <jpeglib.h>
@@ -119,7 +120,15 @@ check_embedded_art(const char * path, const char * image_data, int image_size)
}
else
{
- DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed\n", art_path, last_path);
+ if( errno == ENOENT )
+ {
+ cache_dir = strdup(art_path);
+ make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ free(cache_dir);
+ if( link(last_path, art_path) == 0 )
+ return(art_path);
+ }
+ DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed [%s]\n", art_path, last_path, strerror(errno));
free(art_path);
art_path = NULL;
}