From 5cc634c7d36b5c50d560bff2ae75f8b7e0f9ee34 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 13 Jan 2012 18:05:44 +0200 Subject: [PATCH] Eliminate stupid fsm->path/opath in FSM_COMMIT now that we can - Now that we can directly operate on temporarily variables instead of having to save-ping-restore-pong them, lets do so... - Also eliminating NULL-checks on the path variables in logging - if either of the paths were NULL we would've already crashed in rename() --- lib/fsm.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/fsm.c b/lib/fsm.c index 7e2afbe..00f3a1d 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -1903,20 +1903,14 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (fsm->osuffix && fsm->diskchecked && (fsm->exists || (fsm->goal == FSM_PKGINSTALL && S_ISREG(st->st_mode)))) { - char * opath = fsm->opath; - char * path = fsm->path; - fsm->opath = fsmFsPath(fsm, st, NULL, NULL); - fsm->path = fsmFsPath(fsm, st, NULL, fsm->osuffix); - rc = fsmRename(fsm->opath, fsm->path, fsm->mapFlags); + char * opath = fsmFsPath(fsm, st, NULL, NULL); + char * path = fsmFsPath(fsm, st, NULL, fsm->osuffix); + rc = fsmRename(opath, path, fsm->mapFlags); if (!rc) { - rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"), - (fsm->opath ? fsm->opath : ""), - (fsm->path ? fsm->path : "")); + rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"), opath, path); } - fsm->path = _free(fsm->path); - fsm->path = path; - fsm->opath = _free(fsm->opath); - fsm->opath = opath; + free(path); + free(opath); } /* Remove erased files. */ -- 2.7.4