projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check result of fread
[yaz-moved-to-github.git]
/
util
/
yaz-url.c
diff --git
a/util/yaz-url.c
b/util/yaz-url.c
index
cf9974f
..
ed5d8bb
100644
(file)
--- a/
util/yaz-url.c
+++ b/
util/yaz-url.c
@@
-4,7
+4,7
@@
*/
#if HAVE_CONFIG_H
*/
#if HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <string.h>
#endif
#include <string.h>
@@
-45,7
+45,12
@@
static char *get_file(const char *fname, size_t *len)
{
buf = xmalloc(*len);
fseek(inf, 0L, SEEK_SET);
{
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;
}
fclose(inf);
return buf;