From 88e108cacc1f80e6e91cc4565ad879beff369800 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Tue, 27 Nov 2012 13:02:59 +0100 Subject: [PATCH] fixed #20 --- core/plugins.c | 4 ++-- core/utils.c | 25 +++++++++++++++++++++++++ uwsgi.h | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/core/plugins.c b/core/plugins.c index 14600750fe..8986e3f31a 100644 --- a/core/plugins.c +++ b/core/plugins.c @@ -76,8 +76,8 @@ void *uwsgi_load_plugin(int modifier, char *plugin, char *has_option) { char *plugin_filename = NULL; int need_free = 0; - char *plugin_name = plugin; - char *plugin_symbol_name_start = plugin; + char *plugin_name = uwsgi_strip(uwsgi_str(plugin)); + char *plugin_symbol_name_start = plugin_name; struct uwsgi_plugin *up; char linkpath_buf[1024], linkpath[1024]; diff --git a/core/utils.c b/core/utils.c index 7d25d90a1c..598d84e227 100644 --- a/core/utils.c +++ b/core/utils.c @@ -5123,3 +5123,28 @@ int uwsgi_plugin_modifier1(char *plugin) { free(symbol_name); return ret; } + +char *uwsgi_strip(char *src) { + char *dst = src ; + size_t len = strlen(src); + int i; + + for(i=0;i<(ssize_t)len;i++) { + if (src[i] == ' ' || src[i] == '\t') { + dst++; + } + } + + len -= (dst-src); + + for(i=len;i>=0;i--) { + if (dst[i] == ' ' || dst[i] == '\t') { + dst[i] = 0; + } + else { + break; + } + } + + return dst; +} diff --git a/uwsgi.h b/uwsgi.h index 59904b1634..ad1de1f6f7 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -3497,6 +3497,8 @@ void uwsgi_user_unlock(int); void simple_loop_run_int(int); +char *uwsgi_strip(char *); + void uwsgi_check_emperor(void); #ifdef UWSGI_AS_SHARED_LIBRARY int uwsgi_init(int, char **, char **);