Add check to stop loading plugins twice

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2751 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.27
Stefan Bühler 2010-08-05 22:55:18 +00:00
parent 12f375f3b1
commit 614bb7538d
2 changed files with 9 additions and 1 deletions

1
NEWS
View File

@ -26,6 +26,7 @@ NEWS
* autotools: don't recreate parser files with lemon after lemon rebuild
* openssl: silence annoying error messages for errno==0 (fixes #2213)
* array.c: improve array_get_unused_element to check data type; fix mem leak if unused_element didn't find a matching entry (fixes #2145)
* add check to stop loading plugins twice
- 1.4.26 - 2010-02-07
* Fix request parser to handle packets with splitted \r\n\r\n (fixes #2105)

View File

@ -120,12 +120,19 @@ int plugins_load(server *srv) {
plugin *p;
int (*init)(plugin *pl);
const char *error;
size_t i;
size_t i, j;
for (i = 0; i < srv->srvconf.modules->used; i++) {
data_string *d = (data_string *)srv->srvconf.modules->data[i];
char *modules = d->value->ptr;
for (j = 0; j < i; j++) {
if (buffer_is_equal(d->value, ((data_string *) srv->srvconf.modules->data[j])->value)) {
log_error_write(srv, __FILE__, __LINE__, "sbs", "Cannot load plugin", d->value, "more than once");
return -1;
}
}
buffer_copy_string_buffer(srv->tmp_buf, srv->srvconf.modules_dir);
buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("/"));