From dd0569502c006e4825c994f989da84e2174f2dc4 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Fri, 7 Nov 2003 04:54:24 +0000 Subject: [PATCH] Mostly fixed scanning bug --- src/daap-proto.c | 14 ++++++++------ src/mp3-scanner.c | 5 ++++- src/mt-daapd.conf | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/daap-proto.c b/src/daap-proto.c index 2d68a011..2c81ffa3 100644 --- a/src/daap-proto.c +++ b/src/daap-proto.c @@ -272,11 +272,13 @@ int daap_serialmem(DAAP_BLOCK *root, char *where) { where+=root->size; } - - if(daap_serialmem(root->children,where)) - return -1; - - where += root->reported_size; + + if(root->children) { + if(daap_serialmem(root->children,where)) + return -1; + + where += root->reported_size; + } if(daap_serialmem(root->next,where)) return -1; @@ -301,7 +303,7 @@ int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) { int err; uncompressed_len = root->reported_size + 8; - uncompressed=(char*)malloc(uncompressed_len); + uncompressed=(char*)malloc(uncompressed_len+1); if(!uncompressed) { DPRINTF(ERR_INFO,"Error allocating serialization block\n"); return -1; diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index c11bb183..82acd20c 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -87,12 +87,13 @@ int scan_foreground(char *path) { pde=&de; err=readdir_r(current_dir,&de,&pde); if(err == -1) { + DPRINTF(ERR_DEBUG,"Error on readdir_r: %s\n",strerror(errno)); err=errno; closedir(current_dir); errno=err; return -1; } - + if(!pde) break; @@ -106,6 +107,8 @@ int scan_foreground(char *path) { mp3file.path=mp3_path; mp3file.fname=de.d_name; + /* Do the tag lookup here */ + db_add(&mp3file); } } diff --git a/src/mt-daapd.conf b/src/mt-daapd.conf index 3c3f29c6..068d1cac 100644 --- a/src/mt-daapd.conf +++ b/src/mt-daapd.conf @@ -1,4 +1,4 @@ web_root /home/ron/working/mt-daapd/admin-root port 3689 admin_password secret -mp3_dir /home/ron/mp3 +mp3_dir mp3