diff --git a/src/modules/module-match.c b/src/modules/module-match.c index f6316b93a..9e3edb702 100644 --- a/src/modules/module-match.c +++ b/src/modules/module-match.c @@ -39,6 +39,7 @@ #include #include #include +#include #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);