summaryrefslogtreecommitdiff
path: root/lib/rpmrc.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-25 13:39:44 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-25 15:28:45 +0300
commit12ad8a5194168cf5213dc359283a8997c5501999 (patch)
tree615404d1ad02002e939aa51899dab491a993757f /lib/rpmrc.c
parenta2addde0f041531a47dbb20ba8d8cc5a5de1488f (diff)
downloadlibrpm-tizen-12ad8a5194168cf5213dc359283a8997c5501999.tar.gz
librpm-tizen-12ad8a5194168cf5213dc359283a8997c5501999.tar.bz2
librpm-tizen-12ad8a5194168cf5213dc359283a8997c5501999.zip
Simplify setPathDefault()
- use rpmGetPath() to get sanitized path, avoid alloca()
Diffstat (limited to 'lib/rpmrc.c')
-rw-r--r--lib/rpmrc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 18ffd01c1..9dd9d69e2 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -438,12 +438,9 @@ static void setPathDefault(const char * macroname, const char * subdir)
{
if (macroname != NULL) {
-#define _TOPDIRMACRO "%{_topdir}/"
- char *body = alloca(sizeof(_TOPDIRMACRO) + strlen(subdir));
- strcpy(body, _TOPDIRMACRO);
- strcat(body, subdir);
+ char *body = rpmGetPath("%{_topdir}/", subdir, NULL);
addMacro(NULL, macroname, NULL, body, RMIL_DEFAULT);
-#undef _TOPDIRMACRO
+ free(body);
}
}