ungz: handle bad return from gzip
This commit is contained in:
parent
b48b8541a4
commit
e05b89b745
1
.gitignore
vendored
1
.gitignore
vendored
@ -55,6 +55,7 @@
|
||||
# zlib
|
||||
/base/usr/include/zconf.h
|
||||
/base/usr/include/zlib.h
|
||||
/util/ungz
|
||||
|
||||
# binutils
|
||||
/base/usr/i686-pc-toaru
|
||||
|
2
Makefile
2
Makefile
@ -385,5 +385,5 @@ ext-freetype: base/lib/libtoaru_ext_freetype_fonts.so
|
||||
ext-cairo: base/lib/libtoaru_ext_cairo_renderer.so
|
||||
|
||||
# Other extra stuff
|
||||
fatbase/extra/ungz: util/ungz.c
|
||||
util/ungz: util/ungz.c
|
||||
$(CC) -o $@ $< -lz
|
||||
|
@ -42,6 +42,7 @@ int main(int argc, char **argv) {
|
||||
while (!gzeof(src)) {
|
||||
char buf[1024];
|
||||
int r = gzread(src, buf, 1024);
|
||||
if (r < 0) return 1;
|
||||
fwrite(buf, r, 1, dest);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user