projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d0c9fa
)
* memset config before reading it
author
Wilfried Göesgens
<willi@citadel.org>
Tue, 5 Jan 2010 22:58:11 +0000
(22:58 +0000)
committer
Wilfried Göesgens
<willi@citadel.org>
Tue, 5 Jan 2010 22:58:11 +0000
(22:58 +0000)
* warn if the file didn't have the size we expected
citadel/config.c
patch
|
blob
|
history
diff --git
a/citadel/config.c
b/citadel/config.c
index bc42c559a76d36a8985c76e0d57766f406bd8c37..4c2509f0028d49b569814aec4fa07fa77926dcae 100644
(file)
--- a/
citadel/config.c
+++ b/
citadel/config.c
@@
-67,7
+67,14
@@
void get_config(void) {
strerror(errno));
exit(CTDLEXIT_CONFIG);
}
+ memset(&config, 0, sizeof(struct config));
rv = fread((char *) &config, sizeof(struct config), 1, cfp);
+ if (rv != sizeof(struct config))
+ {
+ fprintf(stderr,
+ "Warning: The config file %s has unexpected size. \n",
+ file_citadel_config);
+ }
if (fstat(fileno(cfp), &st)) {
perror(file_citadel_config);
exit(CTDLEXIT_CONFIG);