X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/19b27a485e833e08160ef0bae8f604c6f60e5ef8..6afe7f23b0440d3261fb99e3f7b4d56bd00713cc:/popt/popt.c diff --git a/popt/popt.c b/popt/popt.c index ae608f19..aef79566 100644 --- a/popt/popt.c +++ b/popt/popt.c @@ -227,7 +227,7 @@ static void execCommand(poptContext con) { if (!con->execAbsolute && strchr(script, '/')) return; if (!strchr(script, '/') && con->execPath) { - char *s = alloca(strlen(con->execPath) + strlen(script) + 2); + char *s = malloc(strlen(con->execPath) + strlen(script) + 2); sprintf(s, "%s/%s", con->execPath, script); argv[pos] = s; } else { @@ -398,6 +398,14 @@ int poptGetNextOpt(poptContext con) const struct poptOption * opt = NULL; int done = 0; + /* looks a bit tricky to get rid of alloca properly in this fn */ +#if HAVE_ALLOCA_H +#define ALLOCA(x) alloca(x) +#else +#define ALLOCA(x) malloc(x) +#endif + + while (!done) { const char * origOptString = NULL; poptCallbackType cb = NULL; @@ -436,7 +444,7 @@ int poptGetNextOpt(poptContext con) /* Make a copy we can hack at */ localOptString = optString = - strcpy(alloca(strlen(origOptString) + 1), + strcpy(ALLOCA(strlen(origOptString) + 1), origOptString); if (!optString[0])