diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-26 08:16:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-26 08:16:51 +0200 |
commit | 7fbc419525c76512b3fdc72987f636bec90554de (patch) | |
tree | 8690fcf83bc724fb39d15b1c9a957ecd7c1d12fd /libbuild2/cc/common.cxx | |
parent | ef6bed5476d7b20aafd4a8a96945a5e603cc360e (diff) |
Fix race in library metadata protocol
Specifically, we need to check whether the prerequisite_member is ad hoc
before checking whether it is NULL because ad hoc ones are blanked out (set to
NULL) during execute.
Diffstat (limited to 'libbuild2/cc/common.cxx')
-rw-r--r-- | libbuild2/cc/common.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx index 8150cfa..ce80e3f 100644 --- a/libbuild2/cc/common.cxx +++ b/libbuild2/cc/common.cxx @@ -240,9 +240,10 @@ namespace build2 for (const prerequisite_target& pt: l.prerequisite_targets[a]) { // Note: adhoc prerequisites are not part of the library meta- - // information protocol. + // information protocol (and we should check for adhoc first to + // avoid races). // - if (pt == nullptr || pt.adhoc) + if (pt.adhoc || pt == nullptr) continue; bool la; |