diff --git a/build/build.c b/build/build.c index c27a671..e173732 100644 --- a/build/build.c +++ b/build/build.c @@ -171,11 +171,11 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test) (void) fputs(buildTemplate, fp); if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir) - fprintf(fp, "cd %s\n", spec->buildSubdir); + fprintf(fp, "cd '%s'\n", spec->buildSubdir); if (what == RPMBUILD_RMBUILD) { if (spec->buildSubdir) - fprintf(fp, "rm -rf %s\n", spec->buildSubdir); + fprintf(fp, "rm -rf '%s'\n", spec->buildSubdir); } else fprintf(fp, "%s", getStringBuf(sb)); diff --git a/build/parsePrep.c b/build/parsePrep.c index 12745be..d6f0c4b 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -364,20 +364,20 @@ static int doSetupMacro(Spec spec, char *line) const char *buildDir; (void) urlPath(buildDirURL, &buildDir); - snprintf(buf, sizeof(buf), "cd %s", buildDir); + snprintf(buf, sizeof(buf), "cd '%s'", buildDir); appendLineStringBuf(spec->prep, buf); buildDirURL = _free(buildDirURL); } /* delete any old sources */ if (!leaveDirs) { - snprintf(buf, sizeof(buf), "rm -rf %s", spec->buildSubdir); + snprintf(buf, sizeof(buf), "rm -rf '%s'", spec->buildSubdir); appendLineStringBuf(spec->prep, buf); } /* if necessary, create and cd into the proper dir */ if (createDir) { - snprintf(buf, sizeof(buf), MKDIR_P " %s\ncd %s", + snprintf(buf, sizeof(buf), MKDIR_P " '%s'\ncd '%s'", spec->buildSubdir, spec->buildSubdir); appendLineStringBuf(spec->prep, buf); } @@ -394,7 +394,7 @@ static int doSetupMacro(Spec spec, char *line) before = freeStringBuf(before); if (!createDir) { - snprintf(buf, sizeof(buf), "cd %s", spec->buildSubdir); + snprintf(buf, sizeof(buf), "cd '%s'", spec->buildSubdir); appendLineStringBuf(spec->prep, buf); }