Commit 237194c5 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Pass back errno if fread fails

To more accurately mimic open() with fopen() we need to make i negative so errno gets reported.
Trim unnecessary library from MD5 makefile
parent ca64db01
......@@ -31,7 +31,7 @@
COMPONENT = MD5
INSTTYPE = app
OBJS = md5 md5c mdXhl
LIBS = ${UNIXLIB} ${SOCK5LIB}
LIBS = ${UNIXLIB}
CINCLUDES = -ITCPIPLibs:,C:
CDEFINES = -DRISCOS_TWEAK
......
......@@ -96,8 +96,10 @@ MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len)
while (n > 0) {
#ifdef RISCOS_TWEAK
i = MIN(n, sizeof(buffer));
if (fread(buffer, sizeof(unsigned char), i, handle) != i)
if (fread(buffer, sizeof(unsigned char), i, handle) != i) {
i = -1;
break;
}
#else
if (n > sizeof(buffer))
i = read(f, buffer, sizeof(buffer));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment