1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Improve fgets() error handling

This commit is contained in:
Moritz Grimm 2016-03-24 17:50:31 +01:00
parent f05462c7ea
commit 1fe0ab595c

View File

@ -126,10 +126,12 @@ _playlist_run_program(struct playlist *pl)
return (NULL); return (NULL);
} }
fgets(buf, (int)sizeof(buf), filep); if (NULL == fgets(buf, (int)sizeof(buf), filep)) {
if (ferror(filep)) { if (ferror(filep))
log_error("%s: output read error: %s", pl->filename, log_error("%s: output read error: %s", pl->filename,
strerror(ferror(filep))); strerror(ferror(filep)));
else
log_error("%s: output read error: EOF", pl->filename);
pclose(filep); pclose(filep);
return (NULL); return (NULL);
} }