Przeglądaj źródła

libdpkg: Rename and lower-case TarInfo members

Guillem Jover 16 lat temu
rodzic
commit
f8a9cacf8a
4 zmienionych plików z 129 dodań i 119 usunięć
  1. 39 39
      lib/dpkg/tarfn.c
  2. 10 10
      lib/dpkg/tarfn.h
  3. 71 61
      src/archives.c
  4. 9 9
      src/filters.c

+ 39 - 39
lib/dpkg/tarfn.c

@@ -128,9 +128,9 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 	else
 		d->format = tar_format_old;
 
-	d->Type = (enum tar_filetype)h->LinkFlag;
-	if (d->Type == tar_filetype_file0)
-		d->Type = tar_filetype_file;
+	d->type = (enum tar_filetype)h->LinkFlag;
+	if (d->type == tar_filetype_file0)
+		d->type = tar_filetype_file;
 
 	if (*h->UserName)
 		passwd = getpwnam(h->UserName);
@@ -139,26 +139,26 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 
 	/* Concatenate prefix and name to support ustar style long names. */
 	if (d->format == tar_format_ustar && h->Prefix[0] != '\0')
-		d->Name = get_prefix_name(h);
+		d->name = get_prefix_name(h);
 	else
-		d->Name = StoC(h->Name, sizeof(h->Name));
-	d->LinkName = StoC(h->LinkName, sizeof(h->LinkName));
-	d->Mode = (mode_t)OtoL(h->Mode, sizeof(h->Mode));
-	d->Size = (size_t)OtoL(h->Size, sizeof(h->Size));
-	d->ModTime = (time_t)OtoL(h->ModificationTime,
-	                          sizeof(h->ModificationTime));
-	d->Device = ((OtoL(h->MajorDevice,
-	                   sizeof(h->MajorDevice)) & 0xff) << 8) |
-	            (OtoL(h->MinorDevice, sizeof(h->MinorDevice)) & 0xff);
+		d->name = StoC(h->Name, sizeof(h->Name));
+	d->linkname = StoC(h->LinkName, sizeof(h->LinkName));
+	d->mode = (mode_t)OtoL(h->Mode, sizeof(h->Mode));
+	d->size = (size_t)OtoL(h->Size, sizeof(h->Size));
+	d->mtime = (time_t)OtoL(h->ModificationTime,
+	                        sizeof(h->ModificationTime));
+	d->dev = ((OtoL(h->MajorDevice,
+	                sizeof(h->MajorDevice)) & 0xff) << 8) |
+	         (OtoL(h->MinorDevice, sizeof(h->MinorDevice)) & 0xff);
 	checksum = OtoL(h->Checksum, sizeof(h->Checksum));
-	d->UserID = (uid_t)OtoL(h->UserID, sizeof(h->UserID));
-	d->GroupID = (gid_t)OtoL(h->GroupID, sizeof(h->GroupID));
+	d->uid = (uid_t)OtoL(h->UserID, sizeof(h->UserID));
+	d->gid = (gid_t)OtoL(h->GroupID, sizeof(h->GroupID));
 
 	if (passwd)
-		d->UserID = passwd->pw_uid;
+		d->uid = passwd->pw_uid;
 
 	if (group)
-		d->GroupID = group->gr_gid;
+		d->gid = group->gr_gid;
 
 	/* Treat checksum field as all blank. */
 	sum = ' ' * sizeof(h->Checksum);
@@ -195,14 +195,14 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 	next_long_link = NULL;
 	symlink_tail = symlink_head = NULL;
 
-	h.Name = NULL;
-	h.LinkName = NULL;
+	h.name = NULL;
+	h.linkname = NULL;
 
 	while ((status = ops->read(ctx, buffer, TARBLKSZ)) == TARBLKSZ) {
 		int nameLength;
 
 		if (!DecodeTarHeader(buffer, &h)) {
-			if (h.Name[0] == '\0') {
+			if (h.name[0] == '\0') {
 				/* End of tape. */
 				status = 0;
 			} else {
@@ -213,38 +213,38 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 			}
 			break;
 		}
-		if (h.Type != tar_filetype_gnu_longlink &&
-		    h.Type != tar_filetype_gnu_longname) {
+		if (h.type != tar_filetype_gnu_longlink &&
+		    h.type != tar_filetype_gnu_longname) {
 			if (next_long_name)
-				h.Name = next_long_name;
+				h.name = next_long_name;
 
 			if (next_long_link)
-				h.LinkName = next_long_link;
+				h.linkname = next_long_link;
 
 			next_long_link = NULL;
 			next_long_name = NULL;
 		}
 
-		if (h.Name[0] == '\0') {
+		if (h.name[0] == '\0') {
 			/* Indicates broken tarfile: “Bad header data”. */
 			errno = 0;
 			status = -1;
 			break;
 		}
 
-		nameLength = strlen(h.Name);
+		nameLength = strlen(h.name);
 
-		switch (h.Type) {
+		switch (h.type) {
 		case tar_filetype_file:
 			/* Compatibility with pre-ANSI ustar. */
-			if (h.Name[nameLength - 1] != '/') {
+			if (h.name[nameLength - 1] != '/') {
 				status = ops->extract_file(ctx, &h);
 				break;
 			}
 			/* Else, fall through. */
 		case tar_filetype_dir:
-			if (h.Name[nameLength - 1] == '/') {
-				h.Name[nameLength - 1] = '\0';
+			if (h.name[nameLength - 1] == '/') {
+				h.name[nameLength - 1] = '\0';
 			}
 			status = ops->mkdir(ctx, &h);
 			break;
@@ -254,8 +254,8 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 		case tar_filetype_symlink:
 			symlink_node = m_malloc(sizeof(*symlink_node));
 			memcpy(&symlink_node->h, &h, sizeof(struct TarInfo));
-			symlink_node->h.Name = m_strdup(h.Name);
-			symlink_node->h.LinkName = m_strdup(h.LinkName);
+			symlink_node->h.name = m_strdup(h.name);
+			symlink_node->h.linkname = m_strdup(h.linkname);
 			symlink_node->next = NULL;
 
 			if (symlink_head)
@@ -274,14 +274,14 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 		case tar_filetype_gnu_longname:
 			/* Set longp to the location of the long filename or
 			 * link we're trying to deal with. */
-			longp = ((h.Type == tar_filetype_gnu_longname) ?
+			longp = ((h.type == tar_filetype_gnu_longname) ?
 			         &next_long_name :
 			         &next_long_link);
 
 			if (*longp)
 				free(*longp);
 
-			*longp = m_malloc(h.Size);
+			*longp = m_malloc(h.size);
 			bp = *longp;
 
 			/* The way the GNU long{link,name} stuff works is like
@@ -292,7 +292,7 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 			 * The next N headers contain the filename.
 			 * After the headers with the filename comes the
 			 *   “real” header with a bogus name or link. */
-			for (long_read = h.Size;
+			for (long_read = h.size;
 			     long_read > 0;
 			     long_read -= TARBLKSZ) {
 				int copysize;
@@ -335,13 +335,13 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
 		symlink_node = symlink_head->next;
 		if (status == 0)
 			status = ops->symlink(ctx, &symlink_head->h);
-		free(symlink_head->h.Name);
-		free(symlink_head->h.LinkName);
+		free(symlink_head->h.name);
+		free(symlink_head->h.linkname);
 		free(symlink_head);
 		symlink_head = symlink_node;
 	}
-	free(h.Name);
-	free(h.LinkName);
+	free(h.name);
+	free(h.linkname);
 
 	if (status > 0) {
 		/* Indicates broken tarfile: “Read partial header record”. */

+ 10 - 10
lib/dpkg/tarfn.h

@@ -49,16 +49,16 @@ enum tar_filetype {
 };
 
 struct	TarInfo {
-	enum tar_format	format;		/* Tar archive format. */
-	char *		Name;		/* File name */
-	mode_t		Mode;		/* Unix mode, including device bits. */
-	size_t		Size;		/* Size of file */
-	time_t		ModTime;	/* Last-modified time */
-	enum tar_filetype Type;		/* Regular, Directory, Special, Link */
-	char *		LinkName;	/* Name for symbolic and hard links */
-	dev_t		Device;		/* Special device for mknod() */
-	uid_t		UserID;		/* Numeric UID */
-	gid_t		GroupID;	/* Numeric GID */
+	enum tar_format format;	/* Tar archive format. */
+	enum tar_filetype type;	/* Regular, Directory, Special, Link */
+	char *name;		/* File name */
+	char *linkname;		/* Name for symbolic and hard links */
+	size_t size;		/* Size of file */
+	time_t mtime;		/* Last-modified time */
+	mode_t mode;		/* Unix mode, including device bits. */
+	uid_t uid;		/* Numeric UID */
+	gid_t gid;		/* Numeric GID */
+	dev_t dev;		/* Special device for mknod() */
 };
 
 typedef int (*tar_read_func)(void *ctx, char *buffer, int length);

+ 71 - 61
src/archives.c

@@ -188,13 +188,13 @@ tarfile_skip_one_forward(struct tarcontext *tc, struct TarInfo *ti)
   /* We need to advance the tar file to the next object, so read the
    * file data and set it to oblivion.
    */
-  if (ti->Type == tar_filetype_file) {
+  if (ti->type == tar_filetype_file) {
     char fnamebuf[256];
 
-    fd_null_copy(tc->backendpipe, ti->Size,
+    fd_null_copy(tc->backendpipe, ti->size,
                  _("skipped unpacking file '%.255s' (replaced or excluded?)"),
-                 path_quote_filename(fnamebuf, ti->Name, 256));
-    r = ti->Size % TARBLKSZ;
+                 path_quote_filename(fnamebuf, ti->name, 256));
+    r = ti->size % TARBLKSZ;
     if (r > 0)
       if (safe_read(tc->backendpipe, databuf, TARBLKSZ - r) == -1)
         ohshite(_("error reading from dpkg-deb pipe"));
@@ -233,18 +233,18 @@ does_replace(struct pkginfo *newpigp, struct pkginfoperfile *newpifp,
 static void newtarobject_utime(const char *path, struct TarInfo *ti) {
   struct utimbuf utb;
   utb.actime= currenttime;
-  utb.modtime= ti->ModTime;
+  utb.modtime = ti->mtime;
   if (utime(path,&utb))
-    ohshite(_("error setting timestamps of `%.255s'"),ti->Name);
+    ohshite(_("error setting timestamps of `%.255s'"), ti->name);
 }
 
 static void newtarobject_allmodes(const char *path, struct TarInfo *ti, struct filestatoverride* statoverride) {
   if (chown(path,
-	    statoverride ? statoverride->uid : ti->UserID,
-	    statoverride ? statoverride->gid : ti->GroupID))
-    ohshite(_("error setting ownership of `%.255s'"),ti->Name);
-  if (chmod(path,(statoverride ? statoverride->mode : ti->Mode) & ~S_IFMT))
-    ohshite(_("error setting permissions of `%.255s'"),ti->Name);
+            statoverride ? statoverride->uid : ti->uid,
+            statoverride ? statoverride->gid : ti->gid))
+    ohshite(_("error setting ownership of `%.255s'"), ti->name);
+  if (chmod(path,(statoverride ? statoverride->mode : ti->mode) & ~S_IFMT))
+    ohshite(_("error setting permissions of `%.255s'"), ti->name);
   newtarobject_utime(path,ti);
 }
 
@@ -366,14 +366,14 @@ linktosameexistingdir(const struct TarInfo *ti, const char *fname,
 
   /* But is it to the same dir ? */
   varbufreset(symlinkfn);
-  if (ti->LinkName[0] == '/') {
+  if (ti->linkname[0] == '/') {
     varbufaddstr(symlinkfn, instdir);
   } else {
     lastslash= strrchr(fname, '/');
     assert(lastslash);
     varbufaddbuf(symlinkfn, fname, (lastslash - fname) + 1);
   }
-  varbufaddstr(symlinkfn, ti->LinkName);
+  varbufaddstr(symlinkfn, ti->linkname);
   varbufaddc(symlinkfn, 0);
 
   statr= stat(symlinkfn->buf, &newstab);
@@ -418,15 +418,16 @@ tarobject(void *ctx, struct TarInfo *ti)
    * been stripped by TarExtractor (lib/tarfn.c).
    */
   oldnifd= tc->newfilesp;
-  nifd= addfiletolist(tc, findnamenode(ti->Name, 0));
+  nifd= addfiletolist(tc, findnamenode(ti->name, 0));
   nifd->namenode->flags |= fnnf_new_inarchive;
 
   debug(dbg_eachfile,
-        "tarobject ti->Name=`%s' Mode=%lo owner=%u.%u Type=%d(%c)"
-        " ti->LinkName=`%s' namenode=`%s' flags=%o instead=`%s'",
-        ti->Name, (long)ti->Mode, (unsigned)ti->UserID, (unsigned)ti->GroupID, ti->Type,
-        ti->Type >= '0' && ti->Type <= '6' ? "-hlcbdp"[ti->Type - '0'] : '?',
-        ti->LinkName,
+        "tarobject ti->name='%s' mode=%lo owner=%u.%u type=%d(%c)"
+        " ti->linkname='%s' namenode='%s' flags=%o instead='%s'",
+        ti->name, (long)ti->mode, (unsigned)ti->uid, (unsigned)ti->gid,
+        ti->type,
+        ti->type >= '0' && ti->type <= '6' ? "-hlcbdp"[ti->type - '0'] : '?',
+        ti->linkname,
         nifd->namenode->name, nifd->namenode->flags,
         nifd->namenode->divert && nifd->namenode->divert->useinstead
         ? nifd->namenode->divert->useinstead->name : "<none>");
@@ -468,7 +469,8 @@ tarobject(void *ctx, struct TarInfo *ti)
   if (statr) {
     /* The lstat failed. */
     if (errno != ENOENT && errno != ENOTDIR)
-      ohshite(_("unable to stat `%.255s' (which I was about to install)"),ti->Name);
+      ohshite(_("unable to stat `%.255s' (which I was about to install)"),
+              ti->name);
     /* OK, so it doesn't exist.
      * However, it's possible that we were in the middle of some other
      * backup/restore operation and were rudely interrupted.
@@ -477,13 +479,13 @@ tarobject(void *ctx, struct TarInfo *ti)
     if (rename(fnametmpvb.buf,fnamevb.buf)) {
       if (errno != ENOENT && errno != ENOTDIR)
         ohshite(_("unable to clean up mess surrounding `%.255s' before "
-                "installing another version"),ti->Name);
+                  "installing another version"), ti->name);
       debug(dbg_eachfiledetail,"tarobject nonexistent");
     } else {
       debug(dbg_eachfiledetail,"tarobject restored tmp to main");
       statr= lstat(fnamevb.buf,&stab);
       if (statr) ohshite(_("unable to stat restored `%.255s' before installing"
-                         " another version"), ti->Name);
+                           " another version"), ti->name);
     }
   } else {
     debug(dbg_eachfiledetail,"tarobject already exists");
@@ -494,7 +496,7 @@ tarobject(void *ctx, struct TarInfo *ti)
    * a file overwriting conflict.
    */
   existingdirectory = false;
-  switch (ti->Type) {
+  switch (ti->type) {
   case tar_filetype_symlink:
     /* If it's already an existing directory, do nothing. */
     if (!statr && S_ISDIR(stab.st_mode)) {
@@ -519,7 +521,8 @@ tarobject(void *ctx, struct TarInfo *ti)
   case tar_filetype_hardlink:
     break;
   default:
-    ohshit(_("archive contained object `%.255s' of unknown type 0x%x"),ti->Name,ti->Type);
+    ohshit(_("archive contained object `%.255s' of unknown type 0x%x"),
+           ti->name, ti->type);
   }
 
   keepexisting = false;
@@ -607,7 +610,7 @@ tarobject(void *ctx, struct TarInfo *ti)
           /* WTA: At this point we are replacing something without a Replaces.
            * if the new object is a directory and the previous object does not
            * exist assume it's also a directory and don't complain. */
-          if (!(statr && ti->Type == tar_filetype_dir))
+          if (!(statr && ti->type == tar_filetype_dir))
             forcibleerr(fc_overwrite,
                         _("trying to overwrite '%.250s', "
                           "which is also in package %.250s %.250s"),
@@ -654,23 +657,24 @@ tarobject(void *ctx, struct TarInfo *ti)
    */
 
   /* Extract whatever it is as .dpkg-new ... */
-  switch (ti->Type) {
+  switch (ti->type) {
   case tar_filetype_file:
     /* We create the file with mode 0 to make sure nobody can do anything with
      * it until we apply the proper mode, which might be a statoverride.
      */
     fd= open(fnamenewvb.buf, (O_CREAT|O_EXCL|O_WRONLY), 0);
     if (fd < 0)
-      ohshite(_("unable to create `%.255s' (while processing `%.255s')"), fnamenewvb.buf, ti->Name);
+      ohshite(_("unable to create `%.255s' (while processing `%.255s')"),
+              fnamenewvb.buf, ti->name);
     push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd);
     debug(dbg_eachfiledetail, "tarobject file open size=%lu",
-          (unsigned long)ti->Size);
+          (unsigned long)ti->size);
     { char fnamebuf[256];
-    fd_fd_copy(tc->backendpipe, fd, ti->Size,
+    fd_fd_copy(tc->backendpipe, fd, ti->size,
                _("backend dpkg-deb during `%.255s'"),
-               path_quote_filename(fnamebuf, ti->Name, 256));
+               path_quote_filename(fnamebuf, ti->name, 256));
     }
-    r= ti->Size % TARBLKSZ;
+    r = ti->size % TARBLKSZ;
     if (r > 0)
       if (safe_read(tc->backendpipe, databuf, TARBLKSZ - r) == -1)
         ohshite(_("error reading from dpkg-deb pipe"));
@@ -680,76 +684,81 @@ tarobject(void *ctx, struct TarInfo *ti)
 			  nifd->namenode->statoverride->gid,
 			  nifd->namenode->statoverride->mode);
     if (fchown(fd,
-	    nifd->namenode->statoverride ? nifd->namenode->statoverride->uid : ti->UserID,
-	    nifd->namenode->statoverride ? nifd->namenode->statoverride->gid : ti->GroupID))
-      ohshite(_("error setting ownership of `%.255s'"),ti->Name);
-    am=(nifd->namenode->statoverride ? nifd->namenode->statoverride->mode : ti->Mode) & ~S_IFMT;
+               nifd->namenode->statoverride ?
+               nifd->namenode->statoverride->uid : ti->uid,
+               nifd->namenode->statoverride ?
+               nifd->namenode->statoverride->gid : ti->gid))
+      ohshite(_("error setting ownership of `%.255s'"), ti->name);
+    am = (nifd->namenode->statoverride ?
+          nifd->namenode->statoverride->mode : ti->mode) & ~S_IFMT;
     if (fchmod(fd,am))
-      ohshite(_("error setting permissions of `%.255s'"),ti->Name);
+      ohshite(_("error setting permissions of `%.255s'"), ti->name);
 
     /* Postpone the fsync, to try to avoid massive I/O degradation. */
     nifd->namenode->flags |= fnnf_deferred_fsync;
 
     pop_cleanup(ehflag_normaltidy); /* fd= open(fnamenewvb.buf) */
     if (close(fd))
-      ohshite(_("error closing/writing `%.255s'"),ti->Name);
+      ohshite(_("error closing/writing `%.255s'"), ti->name);
     newtarobject_utime(fnamenewvb.buf,ti);
     break;
   case tar_filetype_fifo:
     if (mkfifo(fnamenewvb.buf,0))
-      ohshite(_("error creating pipe `%.255s'"),ti->Name);
+      ohshite(_("error creating pipe `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject fifo");
     newtarobject_allmodes(fnamenewvb.buf,ti, nifd->namenode->statoverride);
     break;
   case tar_filetype_chardev:
-    if (mknod(fnamenewvb.buf,S_IFCHR, ti->Device))
-      ohshite(_("error creating device `%.255s'"),ti->Name);
+    if (mknod(fnamenewvb.buf, S_IFCHR, ti->dev))
+      ohshite(_("error creating device `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject chardev");
     newtarobject_allmodes(fnamenewvb.buf,ti, nifd->namenode->statoverride);
     break; 
   case tar_filetype_blockdev:
-    if (mknod(fnamenewvb.buf,S_IFBLK, ti->Device))
-      ohshite(_("error creating device `%.255s'"),ti->Name);
+    if (mknod(fnamenewvb.buf, S_IFBLK, ti->dev))
+      ohshite(_("error creating device `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject blockdev");
     newtarobject_allmodes(fnamenewvb.buf,ti, nifd->namenode->statoverride);
     break; 
   case tar_filetype_hardlink:
     varbufreset(&hardlinkfn);
     varbufaddstr(&hardlinkfn,instdir); varbufaddc(&hardlinkfn,'/');
-    varbufaddstr(&hardlinkfn, ti->LinkName);
-    linknode = findnamenode(ti->LinkName, 0);
+    varbufaddstr(&hardlinkfn, ti->linkname);
+    linknode = findnamenode(ti->linkname, 0);
     if (linknode->flags & fnnf_deferred_rename)
       varbufaddstr(&hardlinkfn, DPKGNEWEXT);
     varbufaddc(&hardlinkfn, '\0');
     if (link(hardlinkfn.buf,fnamenewvb.buf))
-      ohshite(_("error creating hard link `%.255s'"),ti->Name);
+      ohshite(_("error creating hard link `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject hardlink");
     newtarobject_allmodes(fnamenewvb.buf,ti, nifd->namenode->statoverride);
     break;
   case tar_filetype_symlink:
     /* We've already cheched for an existing directory. */
-    if (symlink(ti->LinkName,fnamenewvb.buf))
-      ohshite(_("error creating symbolic link `%.255s'"),ti->Name);
+    if (symlink(ti->linkname, fnamenewvb.buf))
+      ohshite(_("error creating symbolic link `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject symlink creating");
     if (lchown(fnamenewvb.buf,
-	    nifd->namenode->statoverride ? nifd->namenode->statoverride->uid : ti->UserID,
-	    nifd->namenode->statoverride ? nifd->namenode->statoverride->gid : ti->GroupID))
-      ohshite(_("error setting ownership of symlink `%.255s'"),ti->Name);
+               nifd->namenode->statoverride ?
+               nifd->namenode->statoverride->uid : ti->uid,
+               nifd->namenode->statoverride ?
+               nifd->namenode->statoverride->gid : ti->gid))
+      ohshite(_("error setting ownership of symlink `%.255s'"), ti->name);
     break;
   case tar_filetype_dir:
     /* We've already checked for an existing directory. */
     if (mkdir(fnamenewvb.buf,0))
-      ohshite(_("error creating directory `%.255s'"),ti->Name);
+      ohshite(_("error creating directory `%.255s'"), ti->name);
     debug(dbg_eachfiledetail, "tarobject directory creating");
     newtarobject_allmodes(fnamenewvb.buf,ti,nifd->namenode->statoverride);
     break;
   default:
-    internerr("unknown tar type '%d', but already checked", ti->Type);
+    internerr("unknown tar type '%d', but already checked", ti->type);
   }
 
   set_selinux_path_context(fnamevb.buf, fnamenewvb.buf,
                            nifd->namenode->statoverride ?
-                           nifd->namenode->statoverride->mode : ti->Mode);
+                           nifd->namenode->statoverride->mode : ti->mode);
 
   /* CLEANUP: Now we have extracted the new object in .dpkg-new (or,
    * if the file already exists as a directory and we were trying to extract
@@ -774,12 +783,13 @@ tarobject(void *ctx, struct TarInfo *ti)
   if (statr) { /* Don't try to back it up if it didn't exist. */
     debug(dbg_eachfiledetail,"tarobject new - no backup");
   } else {
-    if (ti->Type == tar_filetype_dir || S_ISDIR(stab.st_mode)) {
+    if (ti->type == tar_filetype_dir || S_ISDIR(stab.st_mode)) {
       /* One of the two is a directory - can't do atomic install. */
       debug(dbg_eachfiledetail,"tarobject directory, nonatomic");
       nifd->namenode->flags |= fnnf_no_atomic_overwrite;
       if (rename(fnamevb.buf,fnametmpvb.buf))
-        ohshite(_("unable to move aside `%.255s' to install new version"),ti->Name);
+        ohshite(_("unable to move aside `%.255s' to install new version"),
+                ti->name);
     } else if (S_ISLNK(stab.st_mode)) {
       /* We can't make a symlink with two hardlinks, so we'll have to copy it.
        * (Pretend that making a copy of a symlink is the same as linking to it.)
@@ -788,20 +798,20 @@ tarobject(void *ctx, struct TarInfo *ti)
       varbuf_grow(&symlinkfn, stab.st_size + 1);
       r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size);
       if (r < 0)
-        ohshite(_("unable to read link `%.255s'"), ti->Name);
+        ohshite(_("unable to read link `%.255s'"), ti->name);
       assert(r == stab.st_size);
       varbuf_trunc(&symlinkfn, r);
       varbufaddc(&symlinkfn, '\0');
       if (symlink(symlinkfn.buf,fnametmpvb.buf))
-        ohshite(_("unable to make backup symlink for `%.255s'"),ti->Name);
+        ohshite(_("unable to make backup symlink for `%.255s'"), ti->name);
       if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
-        ohshite(_("unable to chown backup symlink for `%.255s'"),ti->Name);
+        ohshite(_("unable to chown backup symlink for `%.255s'"), ti->name);
       set_selinux_path_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode);
     } else {
       debug(dbg_eachfiledetail,"tarobject nondirectory, `link' backup");
       if (link(fnamevb.buf,fnametmpvb.buf))
         ohshite(_("unable to make backup link of `%.255s' before installing new version"),
-                ti->Name);
+                ti->name);
     }
   }
 
@@ -809,13 +819,13 @@ tarobject(void *ctx, struct TarInfo *ti)
    * in dpkg-new.
    */
 
-  if (ti->Type == tar_filetype_file) {
+  if (ti->type == tar_filetype_file) {
     nifd->namenode->flags |= fnnf_deferred_rename;
 
     debug(dbg_eachfiledetail, "tarobject done and installation deferred");
   } else {
     if (rename(fnamenewvb.buf, fnamevb.buf))
-      ohshite(_("unable to install new version of `%.255s'"), ti->Name);
+      ohshite(_("unable to install new version of `%.255s'"), ti->name);
 
     /* CLEANUP: now the new file is in the destination file, and the
      * old file is in dpkg-tmp to be cleaned up later.  We now need

+ 9 - 9
src/filters.c

@@ -72,17 +72,17 @@ filter_should_skip(struct TarInfo *ti)
 	/* Last match wins. */
 	for (f = filter_head; f != NULL; f = f->next) {
 		debug(dbg_eachfile, "filter comparing '%s' and '%s'",
-		      &ti->Name[1], f->pattern);
+		      &ti->name[1], f->pattern);
 
-		if (fnmatch(f->pattern, &ti->Name[1], 0) == 0) {
+		if (fnmatch(f->pattern, &ti->name[1], 0) == 0) {
 			if (f->include) {
 				skip = false;
 				debug(dbg_eachfile, "filter including %s",
-				      ti->Name);
+				      ti->name);
 			} else {
 				skip = true;
 				debug(dbg_eachfile, "filter removing %s",
-				      ti->Name);
+				      ti->name);
 			}
 		}
 	}
@@ -93,11 +93,11 @@ filter_should_skip(struct TarInfo *ti)
 	 * directories than necessary, but better err on the side of caution
 	 * than failing with “no such file or directory” (which would leave
 	 * the package in a very bad state). */
-	if (skip && (ti->Type == tar_filetype_dir ||
-	             ti->Type == tar_filetype_symlink)) {
+	if (skip && (ti->type == tar_filetype_dir ||
+	             ti->type == tar_filetype_symlink)) {
 		debug(dbg_eachfile,
 		      "filter seeing if '%s' needs to be reincluded",
-		      &ti->Name[1]);
+		      &ti->name[1]);
 
 		for (f = filter_head; f != NULL; f = f->next) {
 			const char *wildcard;
@@ -117,9 +117,9 @@ filter_should_skip(struct TarInfo *ti)
 			debug(dbg_eachfiledetail,
 			      "filter subpattern '%*.s'", path_len, f->pattern);
 
-			if (strncmp(&ti->Name[1], f->pattern, path_len) == 0) {
+			if (strncmp(&ti->name[1], f->pattern, path_len) == 0) {
 				debug(dbg_eachfile, "filter reincluding %s",
-				      ti->Name);
+				      ti->name);
 				return false;
 			}
 		}