Skip to content

Commit

Permalink
fixed #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto De Ioris committed Nov 27, 2012
1 parent 163d71c commit 88e108c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
25 changes: 25 additions & 0 deletions core/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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') {

This comment has been minimized.

Copy link
@akx

akx Nov 27, 2012

Contributor

Why not use isspace, btw?

This comment has been minimized.

Copy link
@rdeioris

rdeioris via email Nov 27, 2012

Collaborator
dst++;
}
}

len -= (dst-src);

for(i=len;i>=0;i--) {
if (dst[i] == ' ' || dst[i] == '\t') {
dst[i] = 0;
}
else {
break;
}
}

return dst;
}
2 changes: 2 additions & 0 deletions uwsgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 **);
Expand Down

0 comments on commit 88e108c

Please sign in to comment.