소스 검색

libdpkg: Consider a hardlink tar entry as a regular file for mode values

The hardlink gets converted into a regular file on extract, so use the
same mode as a regular file would have instead of 0.
Guillem Jover 11 년 전
부모
커밋
4c406e07d2
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      debian/changelog
  2. 1 1
      lib/dpkg/tarfn.c

+ 2 - 0
debian/changelog

@@ -118,6 +118,8 @@ dpkg (1.17.14) UNRELEASED; urgency=low
     Times have changed, and it's common to have at least these many files.
     This reduces the amount of collisions.
   * Document optional dpkg -C argument in --help output. Closes: #763000
+  * Consider a hardlink tar entry as a regular file for mode values, i.e.
+    assign to it S_IFREG instead of 0.
 
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 1 - 1
lib/dpkg/tarfn.c

@@ -101,6 +101,7 @@ get_unix_mode(struct tar_header *h)
 	switch (type) {
 	case TAR_FILETYPE_FILE0:
 	case TAR_FILETYPE_FILE:
+	case TAR_FILETYPE_HARDLINK:
 		mode = S_IFREG;
 		break;
 	case TAR_FILETYPE_SYMLINK:
@@ -118,7 +119,6 @@ get_unix_mode(struct tar_header *h)
 	case TAR_FILETYPE_FIFO:
 		mode = S_IFIFO;
 		break;
-	case TAR_FILETYPE_HARDLINK:
 	default:
 		mode = 0;
 		break;