Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 07e56ec36f5b6db53acae40086fcf8ad > files > 31

rpm-4.4.2.3-20mnb2.src.rpm

commit 5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b
Author: Jindrich Novy <jnovy@redhat.com>
Date:   Wed Sep 10 15:04:57 2008 +0200

    Don't generate broken cpio in case of hardlink pointing on softlink
    - thanks to Pixel

(rediffed for stable branch)

diff -p -up rpm-4.4.2.3/lib/fsm.c.pix rpm-4.4.2.3/lib/fsm.c
--- rpm-4.4.2.3/lib/fsm.c.pix	2008-04-01 09:28:22.000000000 +0200
+++ rpm-4.4.2.3/lib/fsm.c	2008-09-11 10:38:40.000000000 +0200
@@ -1715,7 +1715,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
 	fsm->postpone = XFA_SKIPPING(fsm->action);
 	if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
 	    /*@-evalorder@*/ /* FIX: saveHardLink can modify fsm */
-	    if (!S_ISDIR(st->st_mode) && st->st_nlink > 1)
+	    if (S_ISREG(st->st_mode) && st->st_nlink > 1)
 		fsm->postpone = saveHardLink(fsm);
 	    /*@=evalorder@*/
 	}
@@ -1742,7 +1742,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
 	if (fsm->goal == FSM_PKGBUILD) {
 	    if (fsm->fflags & RPMFILE_GHOST) /* XXX Don't if %ghost file. */
 		break;
-	    if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) {
+	    if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
 		struct hardLink_s * li, * prev;
 
 if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
@@ -1848,7 +1848,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS
 	    if (!IS_DEV_LOG(fsm->path))
 		rc = CPIOERR_UNKNOWN_FILETYPE;
 	}
-	if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) {
+	if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
 	    fsm->li->createdPath = fsm->li->linkIndex;
 	    rc = fsmMakeLinks(fsm);
 	}
@@ -1894,7 +1894,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS
     case FSM_FINI:
 	if (!fsm->postpone && fsm->commit) {
 	    if (fsm->goal == FSM_PKGINSTALL)
-		rc = ((!S_ISDIR(st->st_mode) && st->st_nlink > 1)
+		rc = ((S_ISREG(st->st_mode) && st->st_nlink > 1)
 			? fsmCommitLinks(fsm) : fsmNext(fsm, FSM_COMMIT));
 	    if (fsm->goal == FSM_PKGCOMMIT)
 		rc = fsmNext(fsm, FSM_COMMIT);