aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/tar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/tar.c b/toys/posix/tar.c
index 9642fbe6..77dd6fe9 100644
--- a/toys/posix/tar.c
+++ b/toys/posix/tar.c
@@ -590,7 +590,7 @@ static void unpack_tar(char *first)
else if (tar.type == 'L') alloread(&TT.hdr.name, TT.hdr.size);
else if (tar.type == 'x') {
char *p, *buf = 0;
- int i, len, n;
+ int i, len, n = 0;
// Posix extended record "LEN NAME=VALUE\n" format
alloread(&buf, TT.hdr.size);
@@ -601,7 +601,7 @@ static void unpack_tar(char *first)
break;
}
p[len-1] = 0;
- if (i == 2) {
+ if (n) {
TT.hdr.name = xstrdup(p+n);
break;
}