update: fixing empty filenames in archives

This commit is contained in:
Viliam Mateicka 2008-12-28 19:03:00 +01:00 committed by Max Kellermann
parent c15ac57271
commit 6ad7be9525
2 changed files with 8 additions and 1 deletions

View File

@ -56,7 +56,10 @@ zip_open(char * pathname)
} }
while (zzip_dir_read(context->dir, &dirent)) { while (zzip_dir_read(context->dir, &dirent)) {
context->list = g_slist_prepend( context->list, xstrdup(dirent.d_name)); //add only files
if (dirent.st_size > 0) {
context->list = g_slist_prepend( context->list, xstrdup(dirent.d_name));
}
} }
return (struct archive_file *)context; return (struct archive_file *)context;

View File

@ -296,6 +296,10 @@ update_archive_tree(struct directory *directory, char *name)
//create directories first //create directories first
update_archive_tree(subdir, tmp+1); update_archive_tree(subdir, tmp+1);
} else { } else {
if (strlen(name) == 0) {
g_warning("archive returned directory only\n");
return;
}
//add file //add file
song = songvec_find(&directory->songs, name); song = songvec_find(&directory->songs, name);
if (song == NULL) { if (song == NULL) {