summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-10-10 14:37:57 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-10-10 14:37:57 +0300
commitc17dffb6fbf8c123516ed1ca06a35beca1c7d8c7 (patch)
treeb054f159ce537a4bfa6bb08b851cc8d046057ef1
parenta7ece3bc4ac90b7bc68522aa748e138b78ce4179 (diff)
downloadrpm-c17dffb6fbf8c123516ed1ca06a35beca1c7d8c7.tar.gz
rpm-c17dffb6fbf8c123516ed1ca06a35beca1c7d8c7.tar.bz2
rpm-c17dffb6fbf8c123516ed1ca06a35beca1c7d8c7.zip
Use rpmMkdirs() instead of rpmMkdirPath() in rpmInstallSourcePackage()
-rw-r--r--lib/psm.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/lib/psm.c b/lib/psm.c
index 144fcda5a..abf19cf2c 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -231,9 +231,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
{
int scareMem = 1;
rpmfi fi = NULL;
- char * _topdir = NULL;
- char * _sourcedir = NULL;
- char * _specdir = NULL;
char * specFile = NULL;
Header h = NULL;
struct rpmpsm_s psmbuf;
@@ -336,29 +333,14 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
}
}
- _topdir = rpmGenPath(rpmtsRootDir(ts), "%{_topdir}", "");
- rpmrc = rpmMkdirPath(_topdir, "_topdir");
- if (rpmrc) {
+ if (rpmMkdirs(rpmtsRootDir(ts), "%{_topdir}:%{_sourcedir}:%{_specdir}")) {
rpmrc = RPMRC_FAIL;
goto exit;
}
-
- _sourcedir = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", "");
- rpmrc = rpmMkdirPath(_sourcedir, "_sourcedir");
- if (rpmrc) {
- rpmrc = RPMRC_FAIL;
- goto exit;
- }
-
- _specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
- rpmrc = rpmMkdirPath(_specdir, "_specdir");
- if (rpmrc) {
- rpmrc = RPMRC_FAIL;
- goto exit;
- }
-
/* Build dnl/dil with {_sourcedir, _specdir} as values. */
if (i < fi->fc) {
+ char *_sourcedir = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", "");
+ char *_specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
size_t speclen = strlen(_specdir) + 2;
size_t sourcelen = strlen(_sourcedir) + 2;
char * t;
@@ -379,6 +361,9 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
t = xmalloc(speclen + strlen(fi->bnl[i]) + 1);
(void) stpcpy( stpcpy( stpcpy(t, _specdir), "/"), fi->bnl[i]);
specFile = t;
+
+ free(_specdir);
+ free(_sourcedir);
} else {
rpmlog(RPMLOG_ERR, _("source package contains no .spec file\n"));
rpmrc = RPMRC_FAIL;
@@ -400,9 +385,6 @@ exit:
else
specFile = _free(specFile);
- _specdir = _free(_specdir);
- _sourcedir = _free(_sourcedir);
-
psm->fi = rpmfiFree(psm->fi);
psm->te = NULL;