From 2417acf80a2e892ebace8e849799fb50bdaf0ac3 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Thu, 8 Jan 2015 09:49:32 +0200 Subject: [PATCH] Allow floating-point values for 'megabytes' options. --- core/uwsgi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/uwsgi.c b/core/uwsgi.c index fa81f1a7..7facf96d 100755 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -4059,6 +4059,11 @@ void uwsgi_opt_set_16bit(char *opt, char *value, void *key) { void uwsgi_opt_set_megabytes(char *opt, char *value, void *key) { uint64_t *ptr = (uint64_t *) key; + if(strchr(value, '.') != NULL) { + double megabytes = atof(value); + *ptr = (uint64_t)(megabytes * 1024 * 1024); + return; + } *ptr = (uint64_t)strtoul(value, NULL, 10) * 1024 * 1024; }