From ee9b799822e16b264cf451795fe0df3ecd187cb0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 14 Jun 2013 12:31:43 +0200 Subject: [PATCH] Make sure that only 1 thread can inject the vpkg config files. --- lib/plist_find.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/plist_find.c b/lib/plist_find.c index b9efdac0..1238258b 100644 --- a/lib/plist_find.c +++ b/lib/plist_find.c @@ -30,9 +30,11 @@ #include #include #include +#include #include "xbps_api_impl.h" +static pthread_mutex_t cfg_mtx = PTHREAD_MUTEX_INITIALIZER; static bool cfg_vpkgs_init; static prop_dictionary_t @@ -240,8 +242,10 @@ vpkg_user_conf(struct xbps_handle *xhp, return NULL; /* inject virtual packages from sysconfdir */ + pthread_mutex_lock(&cfg_mtx); if (!cfg_vpkgs_init) config_inject_vpkgs(xhp); + pthread_mutex_unlock(&cfg_mtx); if ((cnt = cfg_size(xhp->cfg, "virtual-package")) == 0) { /* no virtual packages configured */