diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index ff98254..8ce3cba 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -64,12 +64,6 @@
 #undef	MAXSEG_64K
 #define MAXCODE(n)	(1L << (n))
 
-/* Block compress mode -C compatible with 2.0 */
-static int block_mode = BLOCK_MODE;
-
-/* user settable max # bits/code */
-static int maxbits = BITS;
-
 #define	htabof(i)				htab[i]
 #define	codetabof(i)			codetab[i]
 #define	tab_prefixof(i)			codetabof(i)
@@ -109,25 +103,38 @@
 	RESERVE_CONFIG_UBUFFER(outbuf, OBUFSIZ + 2048);
 	unsigned char htab[HSIZE];
 	unsigned short codetab[HSIZE];
+
+	/* Hmm, these were statics - why?! */
+	/* user settable max # bits/code */
+	int maxbits; /* = BITS; */
+	/* block compress mode -C compatible with 2.0 */
+	int block_mode; /* = BLOCK_MODE; */
+
 	memset(inbuf, 0, IBUFSIZ + 64);
 	memset(outbuf, 0, OBUFSIZ + 2048);
 
 	insize = 0;
 
-	inbuf[0] = xread_char(fd_in);
+	/* xread isn't good here, we have to return - caller may want
+	 * to do some cleanup (e.g. delete incomplete unpacked file etc) */
+	if (full_read(fd_in, inbuf, 1) != 1) {
+		bb_error_msg("short read");
+		return -1;
+	}
 
 	maxbits = inbuf[0] & BIT_MASK;
 	block_mode = inbuf[0] & BLOCK_MODE;
 	maxmaxcode = MAXCODE(maxbits);
 
 	if (maxbits > BITS) {
-		bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits,
-				  BITS);
+		bb_error_msg("compressed with %d bits, can only handle "
+				"%d bits", maxbits, BITS);
 		return -1;
 	}
 
-	maxcode = MAXCODE(n_bits = INIT_BITS) - 1;
-	bitmask = (1 << n_bits) - 1;
+	n_bits = INIT_BITS;
+	maxcode = MAXCODE(INIT_BITS) - 1;
+	bitmask = (1 << INIT_BITS) - 1;
 	oldcode = -1;
 	finchar = 0;
 	outpos = 0;
@@ -143,13 +150,14 @@
 	}
 
 	do {
-	  resetbuf:;
+ resetbuf:
 		{
 			int i;
 			int e;
 			int o;
 
-			e = insize - (o = (posbits >> 3));
+			o = posbits >> 3;
+			e = insize - o;
 
 			for (i = 0; i < e; ++i)
 				inbuf[i] = inbuf[i + o];
@@ -160,6 +168,7 @@
 
 		if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) {
 			rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
+//error check??
 			insize += rsize;
 		}
 
@@ -184,8 +193,8 @@
 			{
 				unsigned char *p = &inbuf[posbits >> 3];
 
-				code =	((((long) (p[0])) | ((long) (p[1]) << 8) |
-				          ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
+				code = ((((long) (p[0])) | ((long) (p[1]) << 8) |
+				         ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
 			}
 			posbits += n_bits;
 
@@ -204,8 +213,9 @@
 					((posbits - 1) +
 					 ((n_bits << 3) -
 					  (posbits - 1 + (n_bits << 3)) % (n_bits << 3)));
-				maxcode = MAXCODE(n_bits = INIT_BITS) - 1;
-				bitmask = (1 << n_bits) - 1;
+				n_bits = INIT_BITS;
+				maxcode = MAXCODE(INIT_BITS) - 1;
+				bitmask = (1 << INIT_BITS) - 1;
 				goto resetbuf;
 			}
 
@@ -238,13 +248,15 @@
 				code = tab_prefixof(code);
 			}
 
-			*--stackp = (unsigned char) (finchar = tab_suffixof(code));
+			finchar = tab_suffixof(code);
+			*--stackp = (unsigned char) finchar;
 
 			/* And put them out in forward order */
 			{
 				int i;
 
-				if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) {
+				i = de_stack - stackp;
+				if (outpos + i >= OBUFSIZ) {
 					do {
 						if (i > OBUFSIZ - outpos) {
 							i = OBUFSIZ - outpos;
@@ -256,12 +268,14 @@
 						}
 
 						if (outpos >= OBUFSIZ) {
-							write(fd_out, outbuf, outpos);
+							full_write(fd_out, outbuf, outpos);
+//error check??
 							USE_DESKTOP(total_written += outpos;)
 							outpos = 0;
 						}
 						stackp += i;
-					} while ((i = (de_stack - stackp)) > 0);
+						i = de_stack - stackp;
+					} while (i > 0);
 				} else {
 					memcpy(outbuf + outpos, stackp, i);
 					outpos += i;
@@ -269,7 +283,8 @@
 			}
 
 			/* Generate the new entry. */
-			if ((code = free_ent) < maxmaxcode) {
+			code = free_ent;
+			if (code < maxmaxcode) {
 				tab_prefixof(code) = (unsigned short) oldcode;
 				tab_suffixof(code) = (unsigned char) finchar;
 				free_ent = code + 1;
@@ -282,7 +297,8 @@
 	} while (rsize > 0);
 
 	if (outpos > 0) {
-		write(fd_out, outbuf, outpos);
+		full_write(fd_out, outbuf, outpos);
+//error check??
 		USE_DESKTOP(total_written += outpos;)
 	}
 
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index b4d62f1..7001c70 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -116,7 +116,9 @@
 			/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
 			 * to the front of the bytebuffer, leave 4 bytes free at end of tail
 			 * so we can easily top up buffer in check_trailer_gzip() */
-			if (1 > (bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8)))
+			bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
+			if (1 > bytebuffer_size)
+//shouldn't we propagate error?
 				bb_error_msg_and_die("unexpected end of file");
 			bytebuffer_size += 4;
 			bytebuffer_offset = 4;
@@ -193,7 +195,7 @@
 	eob_len = n > 256 ? b[256] : BMAX;
 
 	/* Generate counts for each bit length */
-	memset((void *)c, 0, sizeof(c));
+	memset(c, 0, sizeof(c));
 	p = b;
 	i = n;
 	do {
@@ -215,11 +217,13 @@
 
 	/* Adjust last length count to fill out codes, if needed */
 	for (y = 1 << j; j < i; j++, y <<= 1) {
-		if ((y -= c[j]) < 0) {
+		y -= c[j];
+		if (y < 0) {
 			return 2; /* bad input: more codes than bits */
 		}
 	}
-	if ((y -= c[i]) < 0) {
+	y -= c[i];
+	if (y < 0) {
 		return 2;
 	}
 	c[i] += y;
@@ -229,14 +233,16 @@
 	p = c + 1;
 	xp = x + 2;
 	while (--i) { /* note that i == g from above */
-		*xp++ = (j += *p++);
+		j += *p++;
+		*xp++ = j;
 	}
 
 	/* Make a table of values in order of bit lengths */
 	p = b;
 	i = 0;
 	do {
-		if ((j = *p++) != 0) {
+		j = *p++;
+		if (j != 0) {
 			v[x[j]++] = i;
 		}
 	} while (++i < n);
@@ -260,13 +266,17 @@
 				w = ws[++htl];
 
 				/* compute minimum size table less than or equal to *m bits */
-				z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
-				if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table */
+				z = g - w;
+				z = z > *m ? *m : z; /* upper limit on table size */
+				j = k - w;
+				f = 1 << j;
+				if (f > a + 1) { /* try a k-w bit table */
 					/* too few codes for k-w bit table */
 					f -= a + 1; /* deduct codes from patterns left */
 					xp = c + k;
 					while (++j < z) { /* try smaller tables up to z bits */
-						if ((f <<= 1) <= *++xp) {
+						f <<= 1;
+						if (f <= *++xp) {
 							break; /* enough codes to use up j bits */
 						}
 						f -= *xp; /* else deduct codes from patterns */
@@ -338,6 +348,8 @@
  * tl, td: literal/length and distance decoder tables
  * bl, bd: number of bits decoded by tl[] and td[]
  */
+/* called with setup==1 once from inflate_block */
+/* called once with setup==0 from inflate_get_next_window */
 static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned my_bl, const unsigned my_bd, int setup)
 {
 	static unsigned e;	/* table entry flag/number of extra bits */
@@ -371,7 +383,9 @@
 
 	while (1) {			/* do until end of block */
 		b = fill_bitbuffer(b, &k, bl);
-		if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
+		t = tl + ((unsigned) b & ml);
+		e = t->e;
+		if (e > 16)
 			do {
 				if (e == 99) {
 					bb_error_msg_and_die("inflate_codes error 1");
@@ -380,8 +394,9 @@
 				k -= t->b;
 				e -= 16;
 				b = fill_bitbuffer(b, &k, e);
-			} while ((e =
-					  (t = t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
+				t = t->v.t + ((unsigned) b & mask_bits[e]);
+				e = t->e;
+			} while (e > 16);
 		b >>= t->b;
 		k -= t->b;
 		if (e == 16) {	/* then it's a literal */
@@ -407,7 +422,9 @@
 
 			/* decode distance of block to copy */
 			b = fill_bitbuffer(b, &k, bd);
-			if ((e = (t = td + ((unsigned) b & md))->e) > 16)
+			t = td + ((unsigned) b & md);
+			e = t->e;
+			if (e > 16)
 				do {
 					if (e == 99)
 						bb_error_msg_and_die("inflate_codes error 2");
@@ -415,9 +432,9 @@
 					k -= t->b;
 					e -= 16;
 					b = fill_bitbuffer(b, &k, e);
-				} while ((e =
-						  (t =
-						   t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
+					t = t->v.t + ((unsigned) b & mask_bits[e]);
+					e = t->e;
+				} while (e > 16);
 			b >>= t->b;
 			k -= t->b;
 			b = fill_bitbuffer(b, &k, e);
@@ -426,26 +443,30 @@
 			k -= e;
 
 			/* do the copy */
-do_copy:		do {
-				n -= (e =
-					  (e =
-					   gunzip_wsize - ((d &= gunzip_wsize - 1) > w ? d : w)) > n ? n : e);
-			   /* copy to new buffer to prevent possible overwrite */
+ do_copy:
+			do {
+				/* Was: n -= (e = (e = gunzip_wsize - ((d &= gunzip_wsize - 1) > w ? d : w)) > n ? n : e); */
+				/* Who wrote THAT?? rewritten as: */
+				d &= gunzip_wsize - 1;
+				e = gunzip_wsize - (d > w ? d : w);
+				if (e > n) e = n;
+				n -= e;
+
+				/* copy to new buffer to prevent possible overwrite */
 				if (w - d >= e) {	/* (this test assumes unsigned comparison) */
 					memcpy(gunzip_window + w, gunzip_window + d, e);
 					w += e;
 					d += e;
 				} else {
-				   /* do it slow to avoid memcpy() overlap */
-				   /* !NOMEMCPY */
+					/* do it slow to avoid memcpy() overlap */
+					/* !NOMEMCPY */
 					do {
 						gunzip_window[w++] = gunzip_window[d++];
 					} while (--e);
 				}
 				if (w == gunzip_wsize) {
 					gunzip_outbuf_count = (w);
-					if (n) resumeCopy = 1;
-					else resumeCopy = 0;
+					resumeCopy = (n != 0);
 					//flush_gunzip_window();
 					w = 0;
 					return 1;
@@ -469,9 +490,12 @@
 	return 0;
 }
 
+/* called once (setup==1) from inflate_block */
+/* and once (setup==0) from inflate_get_next_window */
 static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
 {
 	static unsigned n, b_stored, k_stored, w;
+
 	if (setup) {
 		n = my_n;
 		b_stored = my_b_stored;
@@ -509,7 +533,8 @@
  *
  * GLOBAL VARIABLES: bb, kk,
  */
- // Return values: -1 = inflate_stored, -2 = inflate_codes
+/* Return values: -1 = inflate_stored, -2 = inflate_codes */
+/* One callsite in inflate_get_next_window */
 static int inflate_block(int *e)
 {
 	unsigned t;			/* block type */
@@ -597,7 +622,8 @@
 			l[i] = 8;
 		}
 		bl = 7;
-		if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0) {
+		i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl);
+		if (i != 0) {
 			return i;
 		}
 
@@ -606,7 +632,8 @@
 			l[i] = 5;
 		}
 		bd = 5;
-		if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) {
+		i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd);
+		if (i > 1) {
 			huft_free(tl);
 			return i;
 		}
@@ -745,19 +772,21 @@
 		/* build the decoding tables for literal/length and distance codes */
 		bl = lbits;
 
-		if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
+		i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl);
+		if (i != 0) {
 			if (i == 1) {
 				bb_error_msg_and_die("incomplete literal tree");
-				huft_free(tl);
+				/* huft_free(tl); */
 			}
 			return i;	/* incomplete code set */
 		}
 
 		bd = dbits;
-		if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
+		i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd);
+		if (i != 0) {
 			if (i == 1) {
 				bb_error_msg_and_die("incomplete distance tree");
-				huft_free(td);
+				/* huft_free(td); */
 			}
 			huft_free(tl);
 			return i;	/* incomplete code set */
@@ -776,6 +805,7 @@
 	}
 }
 
+/* Two callsites, both in inflate_get_next_window */
 static void calculate_gunzip_crc(void)
 {
 	int n;
@@ -785,6 +815,7 @@
 	gunzip_bytes_out += gunzip_outbuf_count;
 }
 
+/* One callsite in inflate_unzip */
 static int inflate_get_next_window(void)
 {
 	static int method = -1; // Method == -1 for stored, -2 for codes
@@ -823,7 +854,8 @@
 	/* Doesnt get here */
 }
 
-/* Initialise bytebuffer, be careful not to overfill the buffer */
+/* Initialize bytebuffer, be careful not to overfill the buffer */
+/* Called from archival/unzip.c */
 void inflate_init(unsigned bufsize)
 {
 	/* Set the bytebuffer size, default is same as gunzip_wsize */
@@ -832,11 +864,13 @@
 	bytebuffer_size = 0;
 }
 
+/* Called from archival/unzip.c */
 void inflate_cleanup(void)
 {
 	free(bytebuffer);
 }
 
+/* Called from inflate_gunzip() and archival/unzip.c */
 USE_DESKTOP(long long) int
 inflate_unzip(int in, int out)
 {
@@ -864,7 +898,7 @@
 	while (1) {
 		int ret = inflate_get_next_window();
 		nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
-		if (nwrote == -1) {
+		if (nwrote != gunzip_outbuf_count) {
 			bb_perror_msg("write");
 			return -1;
 		}
@@ -901,6 +935,7 @@
 	count = bytebuffer_size - bytebuffer_offset;
 	if (count < 8) {
 		xread(in, &bytebuffer[bytebuffer_size], 8 - count);
+//shouldn't we propagate error?
 		bytebuffer_size += 8 - count;
 	}
 	for (count = 0; count != 4; count++) {
@@ -917,7 +952,8 @@
 	/* Validate decompression - size */
 	if (gunzip_bytes_out !=
 		(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
-		(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
+		(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))
+	) {
 		bb_error_msg("incorrect length");
 		return -1;
 	}
