diff options
author | Lennart Poettering <lennart@poettering.net> | 2006-05-17 15:21:34 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2006-05-17 15:21:34 +0000 |
commit | 1cfb01ab0eff7b152125e3facdf6c65f98e2707b (patch) | |
tree | e4cc9f149573bd783b7170ba864ff564a883b4c1 | |
parent | e0bf4a32f3ca7b9cf472a37c31be4a6202d39fa8 (diff) |
add proper locking when accessing the file match.table
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@906 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r-- | src/modules/module-match.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/module-match.c b/src/modules/module-match.c index f6316b93..9e3edb70 100644 --- a/src/modules/module-match.c +++ b/src/modules/module-match.c @@ -39,6 +39,7 @@ #include <polypcore/core-subscribe.h> #include <polypcore/xmalloc.h> #include <polypcore/sink-input.h> +#include <polypcore/util.h> #include "module-match-symdef.h" @@ -88,6 +89,8 @@ static int load_rules(struct userdata *u, const char *filename) { goto finish; } + pa_lock_fd(fileno(f), 1); + while (!feof(f)) { char *d, *v; pa_volume_t volume; @@ -146,8 +149,10 @@ static int load_rules(struct userdata *u, const char *filename) { ret = 0; finish: - if (f) + if (f) { + pa_lock_fd(fileno(f), 0); fclose(f); + } if (fn) pa_xfree(fn); |