X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=1bc82beb02be3e0412e9e6b2d9a711707cc91bcd;hb=02a3a65bdd04b3ddf4fa5a84efdd1f0db4acdb5b;hp=639507c3da1d711a605dca6212af155456836987;hpb=f4f09d0626de7ff0d9d3643aa453f90be82c7791;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 639507c..1bc82be 100644 --- a/src/create.c +++ b/src/create.c @@ -1,5 +1,5 @@ /* Create a tar archive. - Copyright (C) 1985, 1992 Free Software Foundation + Copyright (C) 1985, 1992, 1993 Free Software Foundation This file is part of GNU Tar. @@ -60,28 +60,6 @@ struct utimbuf #endif -#if defined(_POSIX_VERSION) || defined(DIRENT) -#include -#ifdef direct -#undef direct -#endif /* direct */ -#define direct dirent -#define DP_NAMELEN(x) strlen((x)->d_name) -#endif /* _POSIX_VERSION or DIRENT */ -#if !defined(_POSIX_VERSION) && !defined(DIRENT) && defined(BSD42) -#include -#define DP_NAMELEN(x) (x)->d_namlen -#endif /* not _POSIX_VERSION and BSD42 */ -#ifdef __MSDOS__ -#include "msd_dir.h" -#define DP_NAMELEN(x) (x)->d_namlen -#define direct dirent -#endif -#if defined(USG) && !defined(_POSIX_VERSION) && !defined(DIRENT) -#include -#define DP_NAMELEN(x) strlen((x)->d_name) -#endif /* USG and not _POSIX_VERSION and not DIRENT */ - extern struct stat hstat; /* Stat struct corresponding */ #ifndef __MSDOS__ @@ -192,10 +170,8 @@ create_archive () } else { - p = name_next (1); - do + while (p = name_next (1)) dump_file (p, -1, 1); - while (p = name_next (1)); } write_eot (); @@ -367,7 +343,7 @@ dump_file (p, curdev, toplevel) } /* Not found. Add it to the list of possible links. */ - lp = (struct link *) malloc ((unsigned) (sizeof (struct link) + strlen (p))); + lp = (struct link *) ck_malloc ((unsigned) (sizeof (struct link) + strlen (p))); if (!lp) { if (!nolinks) @@ -686,7 +662,7 @@ dump_file (p, curdev, toplevel) else if (S_ISDIR (hstat.st_mode)) { register DIR *dirp; - register struct direct *d; + register struct dirent *d; char *namebuf; int buflen; register int len; @@ -831,9 +807,9 @@ dump_file (p, curdev, toplevel) if (is_dot_or_dotdot (d->d_name)) continue; - if (DP_NAMELEN (d) + len >= buflen) + if (NLENGTH (d) + len >= buflen) { - buflen = len + DP_NAMELEN (d); + buflen = len + NLENGTH (d); namebuf = ck_realloc (namebuf, buflen + 1); /* namebuf[len]='\0'; msg("file name %s%s too long", @@ -1014,7 +990,7 @@ init_sparsearray () /* * Make room for our scratch space -- initially is 10 elts long */ - sparsearray = (struct sp_array *) malloc (sp_array_size * sizeof (struct sp_array)); + sparsearray = (struct sp_array *) ck_malloc (sp_array_size * sizeof (struct sp_array)); for (i = 0; i < sp_array_size; i++) { sparsearray[i].offset = 0;