Skip to content
Snippets Groups Projects
Commit 23d4c3bf authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

avoid to read twice the state file

parent 32c5d501
No related branches found
No related tags found
No related merge requests found
......@@ -111,13 +111,15 @@ void sanitize_livestate(resolve_service_t *res)
} else {
if (service_is(&sta, STATE_FLAGS_TOUNSUPERVISE) == STATE_FLAGS_TRUE) {
if (sta.tounsupervise == STATE_FLAGS_TRUE) {
log_trace("unlink: ", ste) ;
unlink_void(ste) ;
if (!state_messenger(res, STATE_FLAGS_TOUNSUPERVISE, STATE_FLAGS_FALSE))
log_dieusys(LOG_EXIT_SYS, "send message to state of: ", name) ;
state_set_flag(&sta, STATE_FLAGS_TOUNSUPERVISE, STATE_FLAGS_FALSE) ;
if (!state_write(&sta, res))
log_dieusys(LOG_EXIT_SYS, "write status file of: ", name) ;
}
}
}
......@@ -83,6 +83,12 @@ static void compute_supervision_dir(resolve_service_t *res)
int r = dir_create_parent(event, 0700) ;
if (!r)
log_dieusys(LOG_EXIT_SYS, "create directory: ", event) ;
/**
*
* ISSUE: All the following means writting on a possible
* ro mountpoint, so crash occurs.
*
* */
if (chown(event, -1, getegid()) < 0)
log_dieusys(LOG_EXIT_SYS, "chown: ", event) ;
......@@ -118,7 +124,7 @@ void sanitize_scandir(resolve_service_t *res)
log_dieu(LOG_EXIT_SYS, "read state file of: ", name) ;
r = access(res->sa.s + res->live.scandir, F_OK) ;
if (r == -1 && service_is(&sta, STATE_FLAGS_TOINIT) == STATE_FLAGS_TRUE) {
if (r == -1 && (sta.toinit == STATE_FLAGS_TRUE || sta.isearlier == STATE_FLAGS_TRUE)) {
if (res->type == TYPE_CLASSIC)
scandir_scandir_to_livestate(res) ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment