From b9f2b0788a19f76e89d782a76bc3d784fe4307d9 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 17 Dec 2007 14:01:23 +0200 Subject: Drop bogus const from fsmFsPath() return type - path is malloced and caller needs to free - additionally use size_t, not int for string size --- lib/fsm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/fsm.c b/lib/fsm.c index e402f598c..271bd2ebc 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -80,18 +80,17 @@ rpmfi fsmGetFi(const FSM_t fsm) * @param st file stat info * @param subdir subdir to use (NULL disables) * @param suffix suffix to use (NULL disables) - * @retval path to file + * @retval path to file (malloced) */ -static -const char * fsmFsPath(const FSM_t fsm, +static char * fsmFsPath(const FSM_t fsm, const struct stat * st, const char * subdir, const char * suffix) { - const char * s = NULL; + char * s = NULL; if (fsm) { - int nb; + size_t nb; char * t; nb = strlen(fsm->dirName) + (st && !S_ISDIR(st->st_mode) ? (subdir ? strlen(subdir) : 0) : 0) + @@ -1806,7 +1805,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; fsm->path = fsmFsPath(fsm, st, NULL, fsm->nsuffix); rc = fsmNext(fsm, FSM_RENAME); if (!rc && fsm->nsuffix) { - const char * opath = fsmFsPath(fsm, st, NULL, NULL); + char * opath = fsmFsPath(fsm, st, NULL, NULL); rpmlog(RPMLOG_WARNING, _("%s created as %s\n"), (opath ? opath : ""), (fsm->path ? fsm->path : "")); -- cgit v1.2.3