summaryrefslogtreecommitdiff
path: root/bin/pax
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2016-12-20 21:29:09 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2016-12-20 21:29:09 +0000
commit9415828f5d3daf5ce72306024b731a16fe0494f5 (patch)
tree124183c15877ce3d6c97d00ce4cf3d30c657287a /bin/pax
parent9bf82bc17e550d5afded386cfa5e34fb614cc5a4 (diff)
Fix a bug where archives smaller than 512 bytes would trigger a next volume
prompt. From NetBSD. ok millert@, deraadt@
Diffstat (limited to 'bin/pax')
-rw-r--r--bin/pax/buf_subs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
index bb0582b0167..41f06ae31cd 100644
--- a/bin/pax/buf_subs.c
+++ b/bin/pax/buf_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf_subs.c,v 1.29 2016/08/26 04:11:16 guenther Exp $ */
+/* $OpenBSD: buf_subs.c,v 1.30 2016/12/20 21:29:08 kettenis Exp $ */
/* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */
/*-
@@ -848,10 +848,13 @@ buf_fill(void)
/*
* errors require resync, EOF goes to next archive
+ * but in case we have not determined yet the format,
+ * this means that we have a very short file, so we
+ * are done again.
*/
if (cnt < 0)
break;
- if (ar_next() < 0) {
+ if (frmt == NULL || ar_next() < 0) {
fini = 1;
return(0);
}