aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-10 15:52:00 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-10 15:52:00 +0200
commitd5d01cbf537f3c292477771d0e0ac6a0cbe19994 (patch)
tree3a620f9200a423caffb5f81e57784bdd1db9a539 /src/mds-server
parentfix compare overflow (diff)
downloadmds-d5d01cbf537f3c292477771d0e0ac6a0cbe19994.tar.gz
mds-d5d01cbf537f3c292477771d0e0ac6a0cbe19994.tar.bz2
mds-d5d01cbf537f3c292477771d0e0ac6a0cbe19994.tar.xz
race condition
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-server/mds-server.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index e63b1af..32cda45 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -994,27 +994,33 @@ void multicast_message(char* message, size_t length)
/* Look for a matching condition. */
n = client->interception_conditions_count;
- with_mutex(mutex,
- for (i = 0; i < n; i++)
- {
- interception_condition_t* cond = conds + i;
- for (j = 0; j < header_count; j++)
- {
- if (*(cond->condition) == '\0')
- break;
- if (cond->header_hash == hashes[j])
- if (strequals(cond->condition, headers[j]) ||
- strequals(cond->condition, header_values[j]))
+ errno = 0;
+ if (client->open)
+ with_mutex(mutex,
+ if (errno || (client->open == 0))
+ n == 0;
+ for (i = 0; i < n; i++)
+ {
+ interception_condition_t* cond = conds + i;
+ for (j = 0; j < header_count; j++)
+ {
+ if (*(cond->condition) == '\0')
break;
- }
- if (j < header_count)
- {
- priority = cond->priority;
- modifying = cond->modifying;
- break;
- }
- }
- );
+ if (cond->header_hash == hashes[j])
+ if (strequals(cond->condition, headers[j]) ||
+ strequals(cond->condition, header_values[j]))
+ break;
+ }
+ if (j < header_count)
+ {
+ priority = cond->priority;
+ modifying = cond->modifying;
+ break;
+ }
+ }
+ );
+ else
+ n = 0;
/* List client of there was a matching condition. */
if (i < n)