1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Improvements to the src-verify.c utility program so that it continues to

muddle through a corrupt manifest file, making the most sense of it that it
can and reporting "manifest" has having changed at the end.

FossilOrigin-Name: 157b5d25e0c99eabfa3c32cb867fe7e3c05031c12354f734d2cd8a4062b9439c
This commit is contained in:
drh
2023-06-08 16:19:21 +00:00
parent 8efe749ab3
commit 2f764eb4f4
3 changed files with 15 additions and 13 deletions

View File

@ -801,6 +801,7 @@ int main(int argc, char **argv){
FILE *in;
int bDebug = 0;
int bNonHuman = 0;
int bSeenManifestErr = 0;
int nErr = 0;
SHA3Context ctx3;
const char *zDir = 0;
@ -874,7 +875,7 @@ int main(int argc, char **argv){
}
in = fopen(zFile, "rb");
if( in==0 ){
printf("missing manifest: \"%s\"\n", zFile);
fprintf(stderr, "missing manifest: \"%s\"\n", zFile);
return 1;
}
SHA3Init(&ctx3, 256);
@ -895,8 +896,8 @@ int main(int argc, char **argv){
zFile[sizeof(zFile)-1] = 0;
defossilize(&zFile[nDir]);
if( zLine[i]!=' ' ){
xErr(&nErr, zVers, "manifest");
return 1;
bSeenManifestErr = 1;
continue;
}
for(i++, j=0; zLine[i]>='0' && zLine[i]<='f'; i++, j++){
if( j<sizeof(zHash) ) zHash[j] = zLine[i];
@ -921,12 +922,13 @@ int main(int argc, char **argv){
xErr(&nErr, zVers, &zFile[nDir]);
}
}else{
xErr(&nErr, zVers, "manifest");
return 1;
bSeenManifestErr = 1;
xErr(&nErr, zVers, &zFile[nDir]);
}
}
fclose(in);
in = 0;
if( bSeenManifestErr ) xErr(&nErr, zVers, "manifest");
memcpy(&zFile[nDir], "manifest.uuid", 14);
if( access(zFile, R_OK)!=0
|| (in = fopen(zFile,"rb"))==0
@ -938,7 +940,7 @@ int main(int argc, char **argv){
xErr(&nErr, zVers, &zFile[nDir]);
}
if( in ) fclose(in);
if( bNonHuman ){
if( nErr ) return 0;
printf("%s\n", zVers);