svn commit: r209311 - stable/7/contrib/cpio/src

Xin LI delphij at FreeBSD.org
Fri Jun 18 18:15:41 UTC 2010


Author: delphij
Date: Fri Jun 18 18:15:40 2010
New Revision: 209311
URL: http://svn.freebsd.org/changeset/base/209311

Log:
  Fix two regressions introduced by GNU cpio 2.8 import:
  
  cpio/src/copyout.c:
  	Old behavior is not to strip leading / from symbol link target.
  
  	By default cpio will replace the symbol link rather than following
  	it so this should not be a risk.
  
  cpio/src/util.c:
  	Zero out rdev_{maj,min} for files where they are not applicable.
  
  This is a direct commit since GNU cpio has been removed from -HEAD.
  
  Sorry for the breakage...
  
  Reported by:	sbruno

Modified:
  stable/7/contrib/cpio/src/copyout.c
  stable/7/contrib/cpio/src/util.c

Modified: stable/7/contrib/cpio/src/copyout.c
==============================================================================
--- stable/7/contrib/cpio/src/copyout.c	Fri Jun 18 17:39:56 2010	(r209310)
+++ stable/7/contrib/cpio/src/copyout.c	Fri Jun 18 18:15:40 2010	(r209311)
@@ -836,9 +836,6 @@ process_copy_out ()
 		    continue;
 		  }
 		link_name[link_size] = 0;
-		cpio_safer_name_suffix (link_name, false,
-					abs_paths_flag, true);
-		link_size = strlen (link_name);
 		file_hdr.c_filesize = link_size;
 		if (archive_format == arf_tar || archive_format == arf_ustar)
 		  {

Modified: stable/7/contrib/cpio/src/util.c
==============================================================================
--- stable/7/contrib/cpio/src/util.c	Fri Jun 18 17:39:56 2010	(r209310)
+++ stable/7/contrib/cpio/src/util.c	Fri Jun 18 18:15:40 2010	(r209311)
@@ -1252,8 +1252,25 @@ stat_to_cpio (struct cpio_file_stat *hdr
   hdr->c_uid = CPIO_UID (st->st_uid);
   hdr->c_gid = CPIO_GID (st->st_gid);
   hdr->c_nlink = st->st_nlink;
-  hdr->c_rdev_maj = major (st->st_rdev);
-  hdr->c_rdev_min = minor (st->st_rdev);
+
+  switch (hdr->c_mode & CP_IFMT)
+  {
+    case CP_IFBLK:
+    case CP_IFCHR:
+#ifdef CP_IFIFO
+    case CP_IFIFO:
+#endif
+#ifdef CP_IFSOCK
+    case CP_IFSOCK:
+#endif
+      hdr->c_rdev_maj = major (st->st_rdev);
+      hdr->c_rdev_min = minor (st->st_rdev);
+      break;
+    default:
+      hdr->c_rdev_maj = 0;
+      hdr->c_rdev_min = 0;
+      break;
+  }
   hdr->c_mtime = st->st_mtime;
   hdr->c_filesize = st->st_size;
   hdr->c_chksum = 0;


More information about the svn-src-stable-7 mailing list