fix: recursive strtok's is a no-no.
authorjbj <devnull@localhost>
Wed, 17 Mar 1999 18:11:01 +0000 (18:11 +0000)
committerjbj <devnull@localhost>
Wed, 17 Mar 1999 18:11:01 +0000 (18:11 +0000)
CVS patchset: 2894
CVS date: 1999/03/17 18:11:01

CHANGES
Makefile.am
autogen.sh
build.c
build/spec.c

diff --git a/CHANGES b/CHANGES
index 6270b22..f3d77de 100644 (file)
--- 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.
index 3a0893b..6ff58c5 100644 (file)
@@ -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
index 38e5af3..4cb5978 100755 (executable)
@@ -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 (file)
--- 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);
index 270fae9..7afe0d4 100644 (file)
@@ -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);