X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=c69d3406a1c859b52afd2695b9136e1bd9885b9a;hb=b4bcb97e386a30996d3d4df8255116fc09c1f505;hp=748f2747d25bd0b618ebba6d38d8df0e5fdcc03a;hpb=166b7c7d028c3dbcfded5c834b9bf752d2fb41f0;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 748f274..c69d340 100644 --- a/src/create.c +++ b/src/create.c @@ -79,7 +79,7 @@ check_exclusion_tags (const char *dirname, const char **tag_file_name) struct exclusion_tag *tag; size_t dlen = strlen (dirname); int addslash = !ISSLASH (dirname[dlen-1]); - char *nptr = NULL; + size_t noff = 0; for (tag = exclusion_tags; tag; tag = tag->next) { @@ -90,14 +90,14 @@ check_exclusion_tags (const char *dirname, const char **tag_file_name) tagname = xrealloc (tagname, tagsize); } - if (!nptr) + if (noff == 0) { strcpy (tagname, dirname); - nptr = tagname + dlen; + noff = dlen; if (addslash) - *nptr++ = '/'; + tagname[noff++] = '/'; } - strcpy (nptr, tag->name); + strcpy (tagname + noff, tag->name); if (access (tagname, F_OK) == 0 && (!tag->predicate || tag->predicate (tagname))) { @@ -996,11 +996,9 @@ finish_header (struct tar_stat_info *st, && header->header.typeflag != XHDTYPE && header->header.typeflag != XGLTYPE) { - /* FIXME: These globals are parameters to print_header, sigh. */ - - current_header = header; + /* FIXME: This global is used in print_header, sigh. */ current_format = archive_format; - print_header (st, current_header, block_ordinal); + print_header (st, header, block_ordinal); } header = write_extended (false, st, header); @@ -1593,6 +1591,8 @@ dump_file0 (struct tar_stat_info *st, const char *p, { exclusion_tag_warning (st->orig_file_name, tag_file_name, _("directory not dumped")); + if (fd >= 0) + close (fd); return; }