diff --git a/binaries/aarch64/tpws b/binaries/aarch64/tpws index dafe9d31..5ba17541 100755 Binary files a/binaries/aarch64/tpws and b/binaries/aarch64/tpws differ diff --git a/binaries/armhf/tpws b/binaries/armhf/tpws index a739b345..8cc1e43e 100755 Binary files a/binaries/armhf/tpws and b/binaries/armhf/tpws differ diff --git a/binaries/mips32r1-lsb/tpws b/binaries/mips32r1-lsb/tpws index 00623811..f5694b42 100755 Binary files a/binaries/mips32r1-lsb/tpws and b/binaries/mips32r1-lsb/tpws differ diff --git a/binaries/mips32r1-msb/tpws b/binaries/mips32r1-msb/tpws index c309bb12..a60bac2f 100755 Binary files a/binaries/mips32r1-msb/tpws and b/binaries/mips32r1-msb/tpws differ diff --git a/binaries/mips64r2-msb/tpws b/binaries/mips64r2-msb/tpws index c6eed5a9..564b8636 100755 Binary files a/binaries/mips64r2-msb/tpws and b/binaries/mips64r2-msb/tpws differ diff --git a/binaries/ppc/tpws b/binaries/ppc/tpws index 2aa4c423..2ea7faeb 100755 Binary files a/binaries/ppc/tpws and b/binaries/ppc/tpws differ diff --git a/binaries/x86/tpws b/binaries/x86/tpws index 591224cf..b0a8e349 100755 Binary files a/binaries/x86/tpws and b/binaries/x86/tpws differ diff --git a/binaries/x86_64/tpws b/binaries/x86_64/tpws index c4e38807..a7dd1509 100755 Binary files a/binaries/x86_64/tpws and b/binaries/x86_64/tpws differ diff --git a/tpws/gzip.c b/tpws/gzip.c index 0f22c023..78efc6fe 100644 --- a/tpws/gzip.c +++ b/tpws/gzip.c @@ -77,5 +77,7 @@ zerr: bool is_gzip(FILE* F) { unsigned char magic[2]; - return !fseek(F,0,SEEK_SET) && fread(magic, 1, 2, F)==2 && magic[0]==0x1F && magic[1]==0x8B; + bool b = !fseek(F,0,SEEK_SET) && fread(magic, 1, 2, F)==2 && magic[0]==0x1F && magic[1]==0x8B; + fseek(F,0,SEEK_SET); + return b; } diff --git a/tpws/hostlist.c b/tpws/hostlist.c index dde04b40..33fac9ac 100644 --- a/tpws/hostlist.c +++ b/tpws/hostlist.c @@ -41,40 +41,37 @@ bool LoadHostList(strpool **hostlist, char *filename) fprintf(stderr, "Could not open %s\n", filename); return false; } - if ((r=z_readfile(F,&zbuf,&zsize))==Z_OK) + + if (is_gzip(F)) { - - printf("zlib compression detected. uncompressed size : %zu\n", zsize); + r = z_readfile(F,&zbuf,&zsize); fclose(F); - - p = zbuf; - e = zbuf + zsize; - while(p