avoid opening files as '#foo' during creation of archives (not just during extraction). Reference: /n/sources/patch/applied/c-no-number-sign Date: Sun Dec 18 12:10:02 CET 2005 --- /sys/src/cmd/tar.c Sun Dec 18 12:09:30 2005 +++ /sys/src/cmd/tar.c Sun Dec 18 12:09:26 2005 @@ -634,10 +634,20 @@ ulong blksleft, blksread; Hdr *hbp; Dir *dir; + String *name = nil; + + if (shortf[0] == '#') { + name = s_new(); + s_append(name, "./"); + s_append(name, shortf); + shortf = s_to_c(name); + } fd = open(shortf, OREAD); if (fd < 0) { fprint(2, "%s: can't open %s: %r\n", argv0, file); + if (name) + s_free(name); return; } dir = dirfstat(fd); @@ -650,6 +660,8 @@ putbackblk(ar); free(dir); close(fd); + if (name) + s_free(name); return; } putblk(ar); @@ -679,6 +691,8 @@ if (verbose) fprint(2, "%s\n", file); } + if (name) + s_free(name); } static char * @@ -783,7 +797,7 @@ { int len; static char *last; - + /* * Always print about files. Only print about directories * we haven't printed about. (Assumes archive is ordered @@ -805,7 +819,7 @@ } fprint(2, "%s: can't create %s: %r\n", argv0, s); } - + static int makedir(char *s) { @@ -826,7 +840,7 @@ { int err; char *p; - + p = s; err = 0; while (!err && (p = strchr(p+1, '/')) != nil) {