diff options
author | Adam Heath <doogie@debian.org> | 2000-12-20 07:27:49 +0000 |
---|---|---|
committer | Adam Heath <doogie@debian.org> | 2000-12-20 07:27:49 +0000 |
commit | 571a4329a10e74ff7c5460a549e05b3dcfbba78f (patch) | |
tree | 8aaba2b37b4488f59ad0105dc8626a74c5ac6752 /dpkg-deb | |
parent | dc1c9e86de7df1490ba49c37d1a9a77ffed820c4 (diff) | |
download | dpkg-571a4329a10e74ff7c5460a549e05b3dcfbba78f.tar.gz |
Fix building of debs, when there is no given compression on the cmdline.
Diffstat (limited to 'dpkg-deb')
-rw-r--r-- | dpkg-deb/build.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index be0e85329..00a774d8e 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -159,13 +159,14 @@ int internalGzip(int fd1, int fd2, const char *compression, char *desc, ...) { va_end(al); - if(compression != NULL) - if(*compression == '0') { - fd_fd_copy(0, 1, -1, _("%s: no compression copy loop"), v.buf); - exit(0); - } + if(compression == NULL) compression= "9"; + if(*compression == '0') { + fd_fd_copy(0, 1, -1, _("%s: no compression copy loop"), v.buf); + exit(0); + } #ifdef USE_ZLIB - snprintf(combuf, sizeof(combuf), "w%c", *compression); + strncpy(combuf, "w9", sizeof(combuf)); + combuf[1]= *compression; gzfile = gzdopen(1, combuf); while((actualread = read(0,gzbuffer,sizeof(gzbuffer))) > 0) { if (actualread < 0 ) { @@ -185,9 +186,11 @@ int internalGzip(int fd1, int fd2, const char *compression, char *desc, ...) { if (gzactualwrite != actualread) ohshite(_("%s: internal gzip error: read(%i) != write(%i)"), v.buf, actualread, gzactualwrite); } + gzclose(gzfile); exit(0); #else - snprintf(combuf, sizeof(combuf), "-%cc", *compression); + strncpy(combuf, "-9c", sizeof(combuf)); + combuf[1]= *compression; execlp(GZIP,"gzip",combuf,(char*)0); ohshit(_("%s: failed to exec gzip %s"), v.buf, combuf); #endif } |