From: jbj Date: Wed, 25 Apr 2001 15:07:53 +0000 (+0000) Subject: - fix: readlink return value clobbered by header write. X-Git-Tag: rpm-4.4-release~1595 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bab8d207cea4bc12502852a8b4566c79b45d66ef;p=platform%2Fupstream%2Frpm.git - fix: readlink return value clobbered by header write. CVS patchset: 4707 CVS date: 2001/04/25 15:07:53 --- diff --git a/CHANGES b/CHANGES index 6b15e1d..bffebf1 100644 --- a/CHANGES +++ b/CHANGES @@ -31,6 +31,7 @@ - cpanflute perl dependency needs explicit epoch (#37034). - regenerate rpm.8 man page from docbook glop (in max-rpm). - lib/depends.c: diddle debugging messages. + - fix: readlink return value clobbered by header write. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/lib/fsm.c b/lib/fsm.c index 4357cc9..42f0de2 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -681,6 +681,7 @@ static int writeFile(FSM_t fsm, int writeData) struct stat * st = &fsm->sb; struct stat * ost = &fsm->osb; size_t pos = fdGetCpioPos(fsm->cfd); + char * symbuf = NULL; int left; int rc; @@ -696,6 +697,7 @@ static int writeFile(FSM_t fsm, int writeData) rc = fsmStage(fsm, FSM_READLINK); if (rc) goto exit; st->st_size = fsm->rdnb; + symbuf = alloca_strdup(fsm->rdbuf); /* XXX save readlink return. */ } if (fsm->mapFlags & CPIO_MAP_ABSOLUTE) { @@ -767,6 +769,8 @@ static int writeFile(FSM_t fsm, int writeData) } else if (writeData && S_ISLNK(st->st_mode)) { /* XXX DWRITE uses rdnb for I/O length. */ + strcpy(fsm->rdbuf, symbuf); /* XXX restore readlink buffer. */ + fsm->rdnb = strlen(symbuf); rc = fsmStage(fsm, FSM_DWRITE); if (rc) goto exit; }