|
Jindrich Novy |
507434 |
commit 5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b
|
|
Jindrich Novy |
507434 |
Author: Jindrich Novy <jnovy@redhat.com>
|
|
Jindrich Novy |
507434 |
Date: Wed Sep 10 15:04:57 2008 +0200
|
|
Jindrich Novy |
507434 |
|
|
Jindrich Novy |
507434 |
Don't generate broken cpio in case of hardlink pointing on softlink
|
|
Jindrich Novy |
507434 |
- thanks to Pixel
|
|
Jindrich Novy |
507434 |
|
|
Jindrich Novy |
507434 |
diff --git a/lib/fsm.c b/lib/fsm.c
|
|
Jindrich Novy |
507434 |
index 0905e3c..8175f82 100644
|
|
Jindrich Novy |
507434 |
--- a/lib/fsm.c
|
|
Jindrich Novy |
507434 |
+++ b/lib/fsm.c
|
|
Jindrich Novy |
507434 |
@@ -1573,7 +1573,7 @@ static int fsmStage(FSM_t fsm, fileStage stage)
|
|
Jindrich Novy |
507434 |
fsm->postpone = XFA_SKIPPING(fsm->action);
|
|
Jindrich Novy |
507434 |
if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
|
|
Jindrich Novy |
507434 |
/* FIX: saveHardLink can modify fsm */
|
|
Jindrich Novy |
507434 |
- if (!S_ISDIR(st->st_mode) && st->st_nlink > 1)
|
|
Jindrich Novy |
507434 |
+ if (S_ISREG(st->st_mode) && st->st_nlink > 1)
|
|
Jindrich Novy |
507434 |
fsm->postpone = saveHardLink(fsm);
|
|
Jindrich Novy |
507434 |
}
|
|
Jindrich Novy |
507434 |
break;
|
|
Jindrich Novy |
507434 |
@@ -1599,7 +1599,7 @@ static int fsmStage(FSM_t fsm, fileStage stage)
|
|
Jindrich Novy |
507434 |
if (fsm->goal == FSM_PKGBUILD) {
|
|
Jindrich Novy |
507434 |
if (fsm->fflags & RPMFILE_GHOST) /* XXX Don't if %ghost file. */
|
|
Jindrich Novy |
507434 |
break;
|
|
Jindrich Novy |
507434 |
- if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) {
|
|
Jindrich Novy |
507434 |
+ if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
|
|
Jindrich Novy |
507434 |
hardLink_t li, prev;
|
|
Jindrich Novy |
507434 |
|
|
Jindrich Novy |
507434 |
if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|
Jindrich Novy |
507434 |
@@ -1699,7 +1699,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|
Jindrich Novy |
507434 |
if (!IS_DEV_LOG(fsm->path))
|
|
Jindrich Novy |
507434 |
rc = CPIOERR_UNKNOWN_FILETYPE;
|
|
Jindrich Novy |
507434 |
}
|
|
Jindrich Novy |
507434 |
- if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) {
|
|
Jindrich Novy |
507434 |
+ if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
|
|
Jindrich Novy |
507434 |
fsm->li->createdPath = fsm->li->linkIndex;
|
|
Jindrich Novy |
507434 |
rc = fsmMakeLinks(fsm);
|
|
Jindrich Novy |
507434 |
}
|
|
Jindrich Novy |
507434 |
@@ -1743,7 +1743,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|
Jindrich Novy |
507434 |
case FSM_FINI:
|
|
Jindrich Novy |
507434 |
if (!fsm->postpone && fsm->commit) {
|
|
Jindrich Novy |
507434 |
if (fsm->goal == FSM_PKGINSTALL)
|
|
Jindrich Novy |
507434 |
- rc = ((!S_ISDIR(st->st_mode) && st->st_nlink > 1)
|
|
Jindrich Novy |
507434 |
+ rc = ((S_ISREG(st->st_mode) && st->st_nlink > 1)
|
|
Jindrich Novy |
507434 |
? fsmCommitLinks(fsm) : fsmNext(fsm, FSM_COMMIT));
|
|
Jindrich Novy |
507434 |
if (fsm->goal == FSM_PKGCOMMIT)
|
|
Jindrich Novy |
507434 |
rc = fsmNext(fsm, FSM_COMMIT);
|