X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-url.c;h=498e2f8e6ce056af075203fa174795d326e12db9;hb=db4394606d431a5070f67299895459d7ed179a4c;hp=5f9a9be39179d4ca2b3f6242c5c4ac7d6b20a2a4;hpb=4c2a1989cfcdeba0338fce5fe9152a37837ef28a;p=yaz-moved-to-github.git diff --git a/util/yaz-url.c b/util/yaz-url.c index 5f9a9be..498e2f8 100644 --- a/util/yaz-url.c +++ b/util/yaz-url.c @@ -1,10 +1,10 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ #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); - 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;