summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-07-22 05:33:29 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-07-22 05:33:29 (GMT)
commit9f40809dc638ea0157fac25e4d8e7a5fa338797c (patch) (side-by-side diff)
tree942b91944f841bafd1dc214e7550420e5c15365a
parentd06b3136f1c52480a9f1c5aa3d38cf557bd7e3e5 (diff)
downloadvmod-tbf-9f40809dc638ea0157fac25e4d8e7a5fa338797c.tar.gz
vmod-tbf-9f40809dc638ea0157fac25e4d8e7a5fa338797c.tar.bz2
Bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/vmod_tbf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vmod_tbf.c b/src/vmod_tbf.c
index 1f2eb6c..4c95272 100644
--- a/src/vmod_tbf.c
+++ b/src/vmod_tbf.c
@@ -175,7 +175,7 @@ tbf_open(const char *mode)
{
pthread_mutex_lock(&mutex);
if (!db)
- tbf_open_internal(mode ? mode : "w");
+ tbf_open_internal(mode ? mode : "truncate");
pthread_mutex_unlock(&mutex);
return db;
}
@@ -189,7 +189,7 @@ void
vmod_open(struct sess *sp, const char *file_name, const char *mode)
{
if (db) {
- syslog(LOG_DAEMON|LOG_ERR, "tbf.config called twice");
+ syslog(LOG_DAEMON|LOG_ERR, "tbf.open called twice");
return;
}
tbf_set_db_name(file_name);
@@ -268,7 +268,9 @@ vmod_rate(struct sess *sp, const char *key, int cost, double t, int burst_size)
}
db = tbf_open(NULL);
-
+ if (!db)
+ return false;
+
memset(&keydat, 0, sizeof keydat);
keydat.data = (void*) key;
keydat.size = strlen(key);

Return to:

Send suggestions and report system problems to the System administrator.