ソースを参照

libdpkg: Move mtime from file_stat back to tar_info

There's never a reason to override the mtime, no point in carrying and
copying it around in file_stat for now.
Guillem Jover 15 年 前
コミット
632048a0a1
共有4 個のファイルを変更した7 個の追加9 個の削除を含む
  1. 0 1
      lib/dpkg/file.h
  2. 1 1
      lib/dpkg/tarfn.c
  3. 1 0
      lib/dpkg/tarfn.h
  4. 5 7
      src/archives.c

+ 0 - 1
lib/dpkg/file.h

@@ -33,7 +33,6 @@ struct file_stat {
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
-	time_t mtime;
 };
 
 void file_copy_perms(const char *src, const char *dst);

+ 1 - 1
lib/dpkg/tarfn.c

@@ -197,7 +197,7 @@ tar_header_decode(struct tar_header *h, struct tar_entry *d)
 	d->linkname = StoC(h->linkname, sizeof(h->linkname));
 	d->stat.mode = get_unix_mode(h);
 	d->size = (off_t)OtoM(h->size, sizeof(h->size));
-	d->stat.mtime = (time_t)OtoM(h->mtime, sizeof(h->mtime));
+	d->mtime = (time_t)OtoM(h->mtime, sizeof(h->mtime));
 	d->dev = ((OtoM(h->devmajor, sizeof(h->devmajor)) & 0xff) << 8) |
 	         (OtoM(h->devminor, sizeof(h->devminor)) & 0xff);
 

+ 1 - 0
lib/dpkg/tarfn.h

@@ -57,6 +57,7 @@ struct tar_entry {
 	char *name;		/* File name */
 	char *linkname;		/* Name for symbolic and hard links */
 	off_t size;		/* Size of file */
+	time_t mtime;		/* Last-modified time. */
 	dev_t dev;		/* Special device for mknod() */
 
 	struct file_stat stat;

+ 5 - 7
src/archives.c

@@ -231,7 +231,7 @@ does_replace(struct pkginfo *newpigp, struct pkgbin *newpifp,
 }
 
 static void
-tarobject_set_mtime(struct tar_entry *te, const char *path, struct file_stat *st)
+tarobject_set_mtime(struct tar_entry *te, const char *path)
 {
   struct timeval tv[2];
 
@@ -240,7 +240,7 @@ tarobject_set_mtime(struct tar_entry *te, const char *path, struct file_stat *st
 
   tv[0].tv_sec = currenttime;
   tv[0].tv_usec = 0;
-  tv[1].tv_sec = st->mtime;
+  tv[1].tv_sec = te->mtime;
   tv[1].tv_usec = 0;
 
   if (utimes(path, tv))
@@ -478,12 +478,10 @@ tarobject(void *ctx, struct tar_entry *ti)
     }
   }
 
-  if (nifd->namenode->statoverride) {
+  if (nifd->namenode->statoverride)
     st = nifd->namenode->statoverride;
-    st->mtime = ti->stat.mtime;
-  } else {
+  else
     st = &ti->stat;
-  }
 
   usenode = namenodetouse(nifd->namenode, tc->pkg);
   usename = usenode->name + 1; /* Skip the leading '/'. */
@@ -777,7 +775,7 @@ tarobject(void *ctx, struct tar_entry *ti)
   }
 
   tarobject_set_perms(ti, fnamenewvb.buf, st);
-  tarobject_set_mtime(ti, fnamenewvb.buf, st);
+  tarobject_set_mtime(ti, fnamenewvb.buf);
   set_selinux_path_context(fnamevb.buf, fnamenewvb.buf, st->mode);
 
   /*