X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-url.c;h=03cb63e819d9fa06bd17c0aa7716f7771e1afa92;hb=5bc2ee09e4dff0f872ce738a5327bced915e3474;hp=cf9974f5009c1cee7c47eab686331dc3851c092e;hpb=77c5a4fca8b516fd39b8ba213daed17a465a6b2a;p=yaz-moved-to-github.git diff --git a/util/yaz-url.c b/util/yaz-url.c index cf9974f..03cb63e 100644 --- a/util/yaz-url.c +++ b/util/yaz-url.c @@ -4,7 +4,7 @@ */ #if HAVE_CONFIG_H -#include "config.h" +#include #endif #include @@ -43,9 +43,15 @@ static char *get_file(const char *fname, size_t *len) *len = ftell(inf); if (*len) /* zero length not considered an error */ { + size_t r; buf = xmalloc(*len); fseek(inf, 0L, SEEK_SET); - (void) fread(buf, 1, *len, inf); + r = fread(buf, 1, *len, inf); + if (r != *len) + { + yaz_log(YLOG_FATAL|YLOG_ERRNO, "short fread of %s", fname); + exit(1); + } } fclose(inf); return buf;