X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/blobdiff_plain/712ecaa057b431ab141bb9864096d6fa49d6c581..HEAD:/agedu.c diff --git a/agedu.c b/agedu.c index 411ae6a..1847e2c 100644 --- a/agedu.c +++ b/agedu.c @@ -1272,6 +1272,11 @@ int main(int argc, char **argv) perror(PNAME ": mmap"); return 1; } + if (!trie_check_magic(mappedfile)) { + fprintf(stderr, "%s: %s: magic numbers did not match\n" + "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); + return 1; + } pathsep = trie_pathsep(mappedfile); /* @@ -1355,6 +1360,21 @@ int main(int argc, char **argv) } return 1; } + if (!trie_check_magic(mappedfile)) { + fprintf(stderr, "%s: %s: magic numbers did not match\n" + "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); + if (!querydir) { + printf("Status: 500\nContent-type: text/html\n\n" + "
" + "agedu
suffered an internal error."
+ "\n");
+ return 0;
+ }
+ return 1;
+ }
pathsep = trie_pathsep(mappedfile);
maxpathlen = trie_maxpathlen(mappedfile);
@@ -1557,6 +1577,11 @@ int main(int argc, char **argv)
perror(PNAME ": mmap");
return 1;
}
+ if (!trie_check_magic(mappedfile)) {
+ fprintf(stderr, "%s: %s: magic numbers did not match\n"
+ "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME);
+ return 1;
+ }
pathsep = trie_pathsep(mappedfile);
maxpathlen = trie_maxpathlen(mappedfile);
@@ -1589,6 +1614,11 @@ int main(int argc, char **argv)
perror(PNAME ": mmap");
return 1;
}
+ if (!trie_check_magic(mappedfile)) {
+ fprintf(stderr, "%s: %s: magic numbers did not match\n"
+ "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME);
+ return 1;
+ }
pathsep = trie_pathsep(mappedfile);
dcfg.address = httpserveraddr;