From d84c548c0ba241ceb19e2a9c1aa457cf5652098d Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 17 Mar 1999 18:11:01 +0000 Subject: [PATCH] fix: recursive strtok's is a no-no. CVS patchset: 2894 CVS date: 1999/03/17 18:11:01 --- CHANGES | 1 + Makefile.am | 2 +- autogen.sh | 2 +- build.c | 9 +++++---- build/spec.c | 5 ----- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 6270b22..f3d77de 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ - fix: with --target=i686, pass macro %_arch=i386. - fix: rpm --target=arch ... resurrected. - fix: rpm -q --specfile --specedit now works even with BuildArch:. + - fix: recursive strtok's is a no-no. 2.90 -> 2.91 - fix: memory leaks in rpmRunTransactions plugged. diff --git a/Makefile.am b/Makefile.am index 3a0893b..6ff58c5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign -EXTRA_DIST = CHANGES CREDITS README.amiga INSTALL RPM-PGP-KEY \ +EXTRA_DIST = CHANGES CREDITS GROUPS README.amiga INSTALL RPM-PGP-KEY \ autodeps/none autodeps/*.prov autodeps/*.req autogen.sh \ docs/[a-z]* gendiff $(man_MANS) po/*.in po/*.po po/rpm.pot \ rpm.magic rpmpopt rpm.spec rpm.8ru rpm2cpio.8ru diff --git a/autogen.sh b/autogen.sh index 38e5af3..4cb5978 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,7 +7,7 @@ USAGE=" You need to install: libtool-1.2d autoconf-2.13 - automake-2.4 + automake-1.4 " [ "`libtoolize --version`" != "$LTV" ] && echo "$USAGE" && exit 1 diff --git a/build.c b/build.c index 0a426de..1f39b26 100644 --- a/build.c +++ b/build.c @@ -170,7 +170,7 @@ int build(const char *arg, int buildAmount, const char *passPhrase, const char *buildRoot, int fromTarball, int test, char *cookie, const char * rcfile, char *targets, int force) { - char *target, *t; + char *t, *te; int rc; if (targets == NULL) { @@ -183,9 +183,10 @@ int build(const char *arg, int buildAmount, const char *passPhrase, printf("Building target platforms: %s\n", targets); - t = targets; - while((target = strtok(t, ",")) != NULL) { - t = NULL; + for (t = targets; (te = strchr(t, ',')) != NULL; t = te) { + char *target = alloca(te-t+1); + strncpy(target, t, (te-t)); + target[te-t] = '\0'; printf("Building for target %s\n", target); rpmReadConfigFiles(rcfile, target); diff --git a/build/spec.c b/build/spec.c index 270fae9..7afe0d4 100644 --- a/build/spec.c +++ b/build/spec.c @@ -485,7 +485,6 @@ void freeSpec(/*@only@*/ Spec spec) headerFree(spec->buildRestrictions); spec->buildRestrictions = NULL; - FREE(spec->buildArchitectures); if (!spec->inBuildArchitectures) { while (spec->buildArchitectureCount--) { @@ -499,10 +498,6 @@ void freeSpec(/*@only@*/ Spec spec) FREE(spec->passPhrase); FREE(spec->cookie); -#ifdef DEAD - freeMacros(spec->macros); -#endif - freeSources(spec->sources); spec->sources = NULL; freePackages(spec); closeSpec(spec); -- 2.7.4