fixed error when not finding cover art

This commit is contained in:
Ron Pedde 2004-04-17 21:40:47 +00:00
parent ffee7a4acf
commit 40169a7e91
2 changed files with 7 additions and 3 deletions

View File

@ -76,7 +76,7 @@ int da_get_image_fd(char *filename) {
path_end = strrchr(buffer,'/');
strcpy(path_end+1,config.artfilename);
fd = open(buffer,O_RDONLY);
if(fd)
if(fd != -1)
DPRINTF(ERR_INFO,"Found image file %s\n",buffer);
return fd;
@ -125,7 +125,11 @@ int da_attach_image(int img_fd, int out_fd, int mp3_fd, int offset)
unsigned char buffer[4];
struct stat sb;
fstat(img_fd,&sb);
if(fstat(img_fd,&sb)) {
DPRINTF(ERR_INFO,"Cannot stat image file... %s\n",strerror(errno));
return 0;
}
img_size=sb.st_size;
DPRINTF(ERR_INFO,"Image appears to be %ld bytes\n",img_size);

View File

@ -285,7 +285,7 @@ void daap_handler(WS_CONNINFO *pwsc) {
if(!offset)
config.stats.songs_served++; /* FIXME: remove stat races */
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path))) {
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path) != -1)) {
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s (fd %d)\n",
pmp3->fname, img_fd);
da_attach_image(img_fd, pwsc->fd, file_fd, offset);