summaryrefslogtreecommitdiff
path: root/src/inputStream_file.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-07-12 13:10:20 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-07-12 13:10:20 +0000
commit25c923809a558583e798cac159fc668f1d8601cc (patch)
treeb59f0a7a18112ad765dda46e995b6472200a8e7c /src/inputStream_file.c
parent5f4f491fb153e90b1b7271b83bb66acccdec68ba (diff)
attempt to work around for bug #274
git-svn-id: https://svn.musicpd.org/mpd/trunk@1847 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputStream_file.c')
-rw-r--r--src/inputStream_file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/inputStream_file.c b/src/inputStream_file.c
index ac0b2d173..d1282201f 100644
--- a/src/inputStream_file.c
+++ b/src/inputStream_file.c
@@ -69,6 +69,9 @@ size_t inputStream_fileRead(InputStream * inStream, void * ptr, size_t size,
size_t readSize;
readSize = fread(ptr,size,nmemb,(FILE *)inStream->data);
+ if(readSize <=0 && ferror((FILE *)inStream->data)) {
+ inStream->error = errno;
+ }
inStream->offset = ftell((FILE *)inStream->data);
@@ -85,10 +88,15 @@ int inputStream_fileClose(InputStream * inStream) {
}
int inputStream_fileAtEOF(InputStream * inStream) {
- return feof((FILE *)inStream->data);
+ if(feof((FILE *)inStream->data)) return 1;
+
+ if(ferror((FILE *)inStream->data) && inStream->error != EINTR) {
+ return 1;
+ }
+
+ return 0;
}
int inputStream_fileBuffer(InputStream * inStream) {
return 0;
}
-/* vim:set shiftwidth=4 tabstop=8 expandtab: */