X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aft.c;h=8473bc9b012b275518e056f2631222eaa954b462;hp=9ec977613e0b78f36d5ef56e974ed986cef85ca8;hb=cdef208272294b567ec80b9defd60e57a0eb2587;hpb=d330cf697501c14bb696256cb27c9e69b9edf3f4;ds=sidebyside diff --git a/aft.c b/aft.c index 9ec97761..8473bc9b 100644 --- a/aft.c +++ b/aft.c @@ -1402,7 +1402,7 @@ static int add_one_audio_file(const char *arg, const void *private_data) const struct private_add_data *pad = private_data; struct audio_format_info afhi, *afhi_ptr = NULL; struct osl_row *pb = NULL, *hs = NULL; /* path brother/hash sister */ - struct osl_object map, obj, query, result; + struct osl_object map, obj = {.data = NULL}, query, result; char *path; HASH_TYPE hash[HASH_SIZE]; @@ -1456,11 +1456,8 @@ static int add_one_audio_file(const char *arg, const void *private_data) */ if (!hs || (pad->flags & ADD_FLAG_FORCE)) { ret = compute_afhi(path, map.data, map.size, &afhi); - if (ret < 0) { - ret = send_va_buffer(pad->fd, - "audio format of %s not recognized\n", path); + if (ret < 0) goto out_unmap; - } format_num = ret; afhi_ptr = &afhi; } @@ -1473,11 +1470,14 @@ static int add_one_audio_file(const char *arg, const void *private_data) out_unmap: munmap(map.data, map.size); out_free: + if (ret < 0) + send_va_buffer(pad->fd, "failed to add %s (%s)\n", path, + PARA_STRERROR(-ret)); free(obj.data); free(path); if (afhi_ptr) free(afhi_ptr->chunk_table); - return ret; + return 1; /* it's not an error if not all files could be added */ } int com_add(int fd, int argc, char * const * const argv) @@ -1517,16 +1517,11 @@ int com_add(int fd, int argc, char * const * const argv) if (S_ISDIR(statbuf.st_mode)) { ret = for_each_file_in_dir(argv[i], add_one_audio_file, &pad); - if (ret < 0) - return ret; continue; } ret = add_one_audio_file(argv[i], &pad); - if (ret < 0) - goto out; } ret = 1; -out: return ret; }