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);
}
fgets(buf, (int)sizeof(buf), filep);
if (ferror(filep)) {
log_error("%s: output read error: %s", pl->filename,
strerror(ferror(filep)));
if (NULL == fgets(buf, (int)sizeof(buf), filep)) {
if (ferror(filep))
log_error("%s: output read error: %s", pl->filename,
strerror(ferror(filep)));
else
log_error("%s: output read error: EOF", pl->filename);
pclose(filep);
return (NULL);
}