#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.93 2016/03/31 17:51:12 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.94 2016/04/19 13:39:19 christos Exp $")
#endif
#include "magic.h"
size_t i, nsz;
char *rbuf;
file_pushbuf_t *pb;
- int rv = 0;
+ int urv, prv, rv = 0;
int mime = ms->flags & MAGIC_MIME;
#ifdef HAVE_SIGNAL_H
sig_t osigpipe;
if (!zm)
continue;
nsz = nbytes;
- rv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
+ urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
DPRINTF("uncompressbuf = %d, %s, %zu\n", rv, (char *)newbuf,
nsz);
- switch (rv) {
+ switch (urv) {
case OKDATA:
case ERRDATA:
ms->flags &= ~MAGIC_COMPRESS;
- if (rv == ERRDATA)
- rv = file_printf(ms, "%s ERROR: %s",
+ if (urv == ERRDATA)
+ prv = file_printf(ms, "%s ERROR: %s",
methodname(i), newbuf);
else
- rv = file_buffer(ms, -1, name, newbuf, nsz);
- if (rv == -1)
+ prv = file_buffer(ms, -1, name, newbuf, nsz);
+ if (prv == -1)
goto error;
- DPRINTF("rv = %d\n", rv);
+ rv = 1;
if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
- break;
+ goto out;
if (mime != MAGIC_MIME && mime != 0)
- break;
+ goto out;
if ((file_printf(ms,
mime ? " compressed-encoding=" : " (")) == -1)
goto error;
break;
}
}
+out:
DPRINTF("rv = %d\n", rv);
#ifdef HAVE_SIGNAL_H