]> git.meshlink.io Git - meshlink/commit
Use a separate lockfile to lock the configuration directory.
authorGuus Sliepen <guus@meshlink.io>
Sat, 9 Nov 2019 16:52:19 +0000 (17:52 +0100)
committerGuus Sliepen <guus@meshlink.io>
Sat, 9 Nov 2019 16:52:19 +0000 (17:52 +0100)
commit6c897377f68fc23ca9a8b23a6ca204517998b2e9
tree0f27e4d98afe07fa9d8c313671a55b74d8e16ad3
parent690df24583e0da336a826b2ad30967cfe9c22277
Use a separate lockfile to lock the configuration directory.

We can't use meshlink.conf as the lock file, since it can move around.
Instead, create meshlink.lock right below confbase, and keep it always
locked while a meshlink handle is valid.

meshlink_destroy() will also use this lockfile to ensure we don't destroy
a directory that is still in use, and prevent race conditions between
meshlink_destroy() and meshlink_open().
src/conf.c
src/conf.h
src/meshlink.c
src/meshlink_internal.h
test/basic.c
test/basicpp.cpp
test/encrypted.c