fix hashtable init
Some checks failed
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Has been cancelled

This commit is contained in:
Vladimir Dubrovin 2026-04-22 12:02:20 +03:00
parent 4f0f3c81e1
commit e6c3427cab

View File

@ -662,7 +662,7 @@ static int h_nscache(int argc, unsigned char **argv){
fprintf(stderr, "Invalid NS cache size: %d\n", res);
return 1;
}
if(dns_table.growlimit != res && inithashtable(&dns_table, (res << 2), (res << 2), res)){
if(dns_table.growlimit != res && inithashtable(&dns_table, (res >> 2), (res >> 2), res)){
fprintf(stderr, "Failed to initialize NS cache\n");
return 2;
}
@ -685,7 +685,7 @@ static int h_nscache6(int argc, unsigned char **argv){
fprintf(stderr, "Invalid NS cache size: %d\n", res);
return 1;
}
if(dns6_table.growlimit != res &&inithashtable(&dns6_table, (res<<2), (res<<2), res)){
if(dns6_table.growlimit != res &&inithashtable(&dns6_table, (res>>2), (res>>2), res)){
fprintf(stderr, "Failed to initialize NS cache\n");
return 2;
}
@ -1449,7 +1449,7 @@ static int h_authcache(int argc, unsigned char **argv){
if(!conf.authcachetype) conf.authcachetype = 6;
if(!conf.authcachetime) conf.authcachetime = 600;
if(!authcachesize) authcachesize = 65536*4;
if(auth_table.growlimit != authcachesize && inithashtable(&auth_table, 1024, 1024, authcachesize)){
if(auth_table.growlimit != authcachesize && inithashtable(&auth_table, authcachesize < 1024? authcachesize:1024, authcachesize < 1024? authcachesize:1024, authcachesize)){
fprintf(stderr, "Failed to initialize auth cache\n");
return 2;
}