*/
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;
}
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)
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;
}
PARA_ERROR(INDEX_CORRUPTION, "fixme"), \
PARA_ERROR(BAD_OFFSET, "fixme"), \
PARA_ERROR(INVALID_OBJECT, "fixme"), \
- PARA_ERROR(MKDIR, "fixme"), \
- PARA_ERROR(OPEN, "fixme"), \
- PARA_ERROR(STAT, "fixme"), \
- PARA_ERROR(FSTAT, "fixme"), \
+ PARA_ERROR(MKDIR, "failed to create directory"), \
+ PARA_ERROR(OPEN, "failed to open file"), \
+ PARA_ERROR(STAT, "can not stat file"), \
+ PARA_ERROR(FSTAT, "fstat error"), \
PARA_ERROR(RENAME, "fixme"), \
- PARA_ERROR(EMPTY, "fixme"), \
+ PARA_ERROR(EMPTY, "file empty"), \
PARA_ERROR(NOSPC, "fixme"), \
- PARA_ERROR(MMAP, "fixme"), \
- PARA_ERROR(MUNMAP, "fixme"), \
+ PARA_ERROR(MMAP, "mmap error"), \
+ PARA_ERROR(MUNMAP, "munmap failed"), \
PARA_ERROR(WRITE, "fixme"), \
PARA_ERROR(LSEEK, "fixme"), \
PARA_ERROR(BUSY, "fixme"), \