Make fsm failedFile non-const like it really is
- callers need to free it so const is wrong - cast away the hardlink-hackery in fsm instead
This commit is contained in:
parent
28723cae06
commit
8bdd462b50
|
@ -48,7 +48,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa,
|
|||
{
|
||||
rpmts ts = rpmtsCreate();
|
||||
rpmfi fi = csa->cpioList;
|
||||
const char *failedFile = NULL;
|
||||
char *failedFile = NULL;
|
||||
FD_t cfd;
|
||||
rpmRC rc = RPMRC_OK;
|
||||
int xx;
|
||||
|
|
12
lib/fsm.c
12
lib/fsm.c
|
@ -493,7 +493,7 @@ FSM_t freeFSM(FSM_t fsm)
|
|||
|
||||
int fsmSetup(FSM_t fsm, fileStage goal,
|
||||
const rpmts ts, const rpmfi fi, FD_t cfd,
|
||||
unsigned int * archiveSize, const char ** failedFile)
|
||||
unsigned int * archiveSize, char ** failedFile)
|
||||
{
|
||||
size_t pos = 0;
|
||||
int rc, ec = 0;
|
||||
|
@ -1844,7 +1844,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|||
/* Notify on success. */
|
||||
if (!rc) rc = fsmNext(fsm, FSM_NOTIFY);
|
||||
else if (fsm->failedFile && *fsm->failedFile == NULL) {
|
||||
*fsm->failedFile = fsm->path;
|
||||
/* XXX ick, stripping const */
|
||||
*fsm->failedFile = (char *) fsm->path;
|
||||
fsm->path = NULL;
|
||||
}
|
||||
break;
|
||||
|
@ -1865,7 +1866,12 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|||
if (fsm->failedFile && *fsm->failedFile == NULL) {
|
||||
fsm->ix = fsm->li->filex[i];
|
||||
if (!fsmNext(fsm, FSM_MAP)) {
|
||||
*fsm->failedFile = fsm->path;
|
||||
/*
|
||||
* XXX ick, stripping const. Out-of-sync
|
||||
* hardlinks handled as sub-state, see
|
||||
* changeset 4062:02b0c237b675
|
||||
*/
|
||||
*fsm->failedFile = (char *) fsm->path;
|
||||
fsm->path = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ struct fsm_s {
|
|||
hardLink_t links; /*!< Pending hard linked file(s). */
|
||||
hardLink_t li; /*!< Current hard linked file(s). */
|
||||
unsigned int * archiveSize; /*!< Pointer to archive size. */
|
||||
const char ** failedFile; /*!< First file name that failed. */
|
||||
char ** failedFile; /*!< First file name that failed. */
|
||||
const char * subdir; /*!< Current file sub-directory. */
|
||||
char subbuf[64]; /* XXX eliminate */
|
||||
const char * osuffix; /*!< Old, preserved, file suffix. */
|
||||
|
@ -204,7 +204,7 @@ FSM_t freeFSM(FSM_t fsm);
|
|||
* @param fi transaction element file info
|
||||
* @param cfd
|
||||
* @retval archiveSize pointer to archive size
|
||||
* @retval failedFile pointer to first file name that failed.
|
||||
* @retval failedFile pointer to first file name that failed (malloced)
|
||||
* @return 0 on success
|
||||
*/
|
||||
int fsmSetup(FSM_t fsm, fileStage goal,
|
||||
|
@ -212,7 +212,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
|
|||
const rpmfi fi,
|
||||
FD_t cfd,
|
||||
unsigned int * archiveSize,
|
||||
const char ** failedFile);
|
||||
char ** failedFile);
|
||||
|
||||
/**
|
||||
* Clean file state machine.
|
||||
|
|
|
@ -54,7 +54,7 @@ struct rpmpsm_s {
|
|||
rpmdbMatchIterator mi;
|
||||
const char * stepName;
|
||||
char * rpmio_flags;
|
||||
const char * failedFile;
|
||||
char * failedFile;
|
||||
char * pkgURL; /*!< Repackage URL. */
|
||||
const char * pkgfn; /*!< Repackage file name. */
|
||||
int scriptTag; /*!< Scriptlet data tag. */
|
||||
|
@ -1886,11 +1886,7 @@ assert(psm->mi == NULL);
|
|||
psm->oh = headerFree(psm->oh);
|
||||
psm->pkgURL = _free(psm->pkgURL);
|
||||
psm->rpmio_flags = _free(psm->rpmio_flags);
|
||||
/*
|
||||
* XXX: funny games with fsm internal state, see changesets
|
||||
* 7340:77828be0ce85 and 4062:02b0c237b675
|
||||
*/
|
||||
psm->failedFile = _constfree(psm->failedFile);
|
||||
psm->failedFile = _free(psm->failedFile);
|
||||
|
||||
fi->fgroup = hfd(fi->fgroup, RPM_FORCEFREE_TYPE);
|
||||
fi->fuser = hfd(fi->fuser, RPM_FORCEFREE_TYPE);
|
||||
|
|
Loading…
Reference in New Issue