From 71d57274e5d69bcdaf0748264cd4f464c5605039 Mon Sep 17 00:00:00 2001 From: "roberto@precise64" Date: Sat, 5 May 2012 07:11:35 +0200 Subject: [PATCH] fixed optional pargs management --- uwsgi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uwsgi.c b/uwsgi.c index 25cbec22..a4cee96b 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -3350,7 +3350,7 @@ void build_options() { if (uwsgi.short_options) free(uwsgi.short_options); - uwsgi.short_options = uwsgi_calloc( (options_count * 2) + 1) ; + uwsgi.short_options = uwsgi_calloc( (options_count * 3) + 1) ; op = uwsgi.options; while(op->name) { @@ -3364,7 +3364,10 @@ void build_options() { // avoid duplicates in short_options if (!strchr(uwsgi.short_options, shortcut)) { strncat(uwsgi.short_options, &shortcut, 1); - if (op->type != no_argument) { + if (op->type == optional_argument) { + strcat(uwsgi.short_options, "::"); + } + else if (op->type == required_argument) { strcat(uwsgi.short_options, ":"); } }