projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d8c5ab
)
Check result of fread
author
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 3 Dec 2012 15:03:04 +0000
(16:03 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 3 Dec 2012 15:03:04 +0000
(16:03 +0100)
util/yaz-url.c
patch
|
blob
|
history
diff --git
a/util/yaz-url.c
b/util/yaz-url.c
index
56f152b
..
ed5d8bb
100644
(file)
--- a/
util/yaz-url.c
+++ b/
util/yaz-url.c
@@
-45,7
+45,12
@@
static char *get_file(const char *fname, size_t *len)
{
buf = xmalloc(*len);
fseek(inf, 0L, SEEK_SET);
- (void) fread(buf, 1, *len, inf);
+ size_t 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;