diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-25 13:39:44 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-25 15:28:45 +0300 |
commit | 12ad8a5194168cf5213dc359283a8997c5501999 (patch) | |
tree | 615404d1ad02002e939aa51899dab491a993757f | |
parent | a2addde0f041531a47dbb20ba8d8cc5a5de1488f (diff) | |
download | rpm-12ad8a5194168cf5213dc359283a8997c5501999.tar.gz rpm-12ad8a5194168cf5213dc359283a8997c5501999.tar.bz2 rpm-12ad8a5194168cf5213dc359283a8997c5501999.zip |
Simplify setPathDefault()
- use rpmGetPath() to get sanitized path, avoid alloca()
-rw-r--r-- | lib/rpmrc.c | 7 |
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); } } |