summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-10-29 16:06:01 +0000
committerjbj <devnull@localhost>1999-10-29 16:06:01 +0000
commit1e0138188b4887431444d90395be0f2fac5c2db3 (patch)
tree921cdb01039a413878fd312ff4656c75dc32a4db /build.c
parent0d0b405c201b43f2eebc61257f5992931e1cdb0c (diff)
downloadlibrpm-tizen-1e0138188b4887431444d90395be0f2fac5c2db3.tar.gz
librpm-tizen-1e0138188b4887431444d90395be0f2fac5c2db3.tar.bz2
librpm-tizen-1e0138188b4887431444d90395be0f2fac5c2db3.zip
check for memory leaks (almost all leaks are plugged).
CVS patchset: 3403 CVS date: 1999/10/29 16:06:01
Diffstat (limited to 'build.c')
-rw-r--r--build.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/build.c b/build.c
index 0071b3f69..c8742c2c5 100644
--- a/build.c
+++ b/build.c
@@ -91,7 +91,6 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
int test = ba->noBuild;
FILE *f;
const char * specfile;
- int res = 0;
struct stat statbuf;
char buf[BUFSIZ];
Spec spec = NULL;
@@ -102,6 +101,7 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
const char *specDir;
const char * tmpSpecFile;
char * cmd, *s;
+ int res;
specDir = rpmGetPath("%{_specdir}", NULL);
@@ -158,13 +158,14 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
s = alloca(strlen(specDir) + strlen(cmd) + 5);
sprintf(s, "%s/%s", specDir, cmd);
+ res = rename(tmpSpecFile, s);
+ xfree(specDir);
+ xfree(tmpSpecFile);
- if (rename(tmpSpecFile, s)) {
+ if (res) {
fprintf(stderr, _("Failed to rename %s to %s: %s\n"),
tmpSpecFile, s, strerror(errno));
unlink(tmpSpecFile);
- xfree(specDir);
- xfree(tmpSpecFile);
return 1;
}
@@ -183,8 +184,6 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
*cmd = '\0';
addMacro(NULL, "_sourcedir", NULL, buf, RMIL_TARBALL);
- xfree(specDir);
- xfree(tmpSpecFile);
specfile = s;
} else if (arg[0] == '/') {
specfile = arg;
@@ -236,7 +235,7 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
freeSpec(spec);
- return res;
+ return 0;
}
int build(const char *arg, struct rpmBuildArguments *ba, const char *passPhrase,