fix
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
Scott E. Graves 2025-03-25 18:32:11 -05:00
parent e55280b21c
commit a27e2527ea

View File

@ -69,15 +69,27 @@ auto lock_data::get_lock_file() const -> std::string {
}
auto lock_data::get_mount_state(json &mount_state) -> bool {
auto handle =
open(get_lock_data_file().c_str(), O_CREAT | O_RDWR, S_IWUSR | S_IRUSR);
auto handle = open(get_lock_data_file().c_str(), O_RDWR, S_IWUSR | S_IRUSR);
if (handle == -1) {
return false;
mount_state = {
{"Active", false},
{"Location", ""},
{"PID", -1},
};
return true;
}
auto ret{false};
if (wait_for_lock(handle) == 0) {
ret = utils::file::read_json_file(get_lock_data_file(), mount_state);
if (ret && mount_state.empty()) {
mount_state = {
{"Active", false},
{"Location", ""},
{"PID", -1},
};
}
flock(handle, LOCK_UN);
}