diff --git a/binaries/aarch64/tpws b/binaries/aarch64/tpws index dafe9d3..5ba1754 100755 Binary files a/binaries/aarch64/tpws and b/binaries/aarch64/tpws differ diff --git a/binaries/armhf/tpws b/binaries/armhf/tpws index a739b34..8cc1e43 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 0062381..f5694b4 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 c309bb1..a60bac2 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 c6eed5a..564b863 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 2aa4c42..2ea7fae 100755 Binary files a/binaries/ppc/tpws and b/binaries/ppc/tpws differ diff --git a/binaries/x86/tpws b/binaries/x86/tpws index 591224c..b0a8e34 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 c4e3880..a7dd150 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 0f22c02..78efc6f 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 dde04b4..33fac9a 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