diff options
author | Jindrich Novy <jnovy@redhat.com> | 2008-09-10 15:04:57 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2008-09-10 15:04:57 +0200 |
commit | 5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b (patch) | |
tree | 6ccf52a2e720756ff08691710301131c3a34d361 /lib | |
parent | ce1db5af7036df54a21abab9a5d70b06a821fff4 (diff) | |
download | rpm-5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b.tar.gz rpm-5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b.tar.bz2 rpm-5c71ced2da7d99b870a07a83dd8f7e8d1f1b7e4b.zip |
Don't generate broken cpio in case of hardlink pointing on softlink
- thanks to Pixel
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fsm.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1573,7 +1573,7 @@ static int fsmStage(FSM_t fsm, fileStage stage) fsm->postpone = XFA_SKIPPING(fsm->action); if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) { /* 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); } break; @@ -1599,7 +1599,7 @@ static 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) { hardLink_t li, prev; if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; @@ -1699,7 +1699,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; 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); } @@ -1743,7 +1743,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; 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); |