Skip to content
Snippets Groups Projects
Commit f77a3259 authored by Eric Vidal's avatar Eric Vidal 💬
Browse files

fix recognition of earlier service

parent e19e1b7e
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
ftrigr_t fifo = FTRIGR_ZERO ;
uint32_t earlier ;
gid_t gid = getgid() ;
int is_supervised = 0, is_init ;
int is_supervised = 0, is_init = 0, gearlier = 0 ;
unsigned int pos = 0, nsv = 0 ;
unsigned int real[alen] ;
unsigned int msg[areslen] ;
......@@ -78,6 +78,8 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if (is_init < 0 || service_is(&sta, STATE_FLAGS_TOINIT) == STATE_FLAGS_TRUE)
sanitize_livestate(&ares[aresid]) ;
if (earlier)
gearlier = aresid ;
/**
* Bundle and module type are not a daemons. We don't need to supervise it.
* Special case for Oneshot, we only deal with the scandir symlink. */
......@@ -101,12 +103,15 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
}
/* down file */
char downfile[scandirlen + 6] ;
auto_strings(downfile, scandir, "/down") ;
int fd = open_trunc(downfile) ;
if (fd < 0)
log_dieusys(LOG_EXIT_SYS, "create file: ", downfile) ;
fd_close(fd) ;
if (!earlier) {
char downfile[scandirlen + 6] ;
auto_strings(downfile, scandir, "/down") ;
int fd = open_trunc(downfile) ;
if (fd < 0)
log_dieusys(LOG_EXIT_SYS, "create file: ", downfile) ;
fd_close(fd) ;
}
if (!earlier && is_supervised) {
......@@ -166,9 +171,6 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
}
}
if (earlier)
sanitize_scandir(&ares[0]) ;
/**
* We pass through here even for Bundle, Module and Oneshot.
* We need to write the state file anyway. Thus can always
......
......@@ -105,6 +105,7 @@ void sanitize_scandir(resolve_service_t *res)
int r ;
char *name = res->sa.s + res->name ;
uint8_t earlier = 0 ;
size_t namelen = strlen(name) ;
size_t livelen = strlen(res->sa.s + res->live.livedir) ;
size_t scandirlen = livelen + SS_SCANDIR_LEN + 1 + strlen(res->sa.s + res->ownerstr) ;
......@@ -126,7 +127,8 @@ void sanitize_scandir(resolve_service_t *res)
compute_supervision_dir(res) ;
if (service_is(&sta, STATE_FLAGS_ISEARLIER) == STATE_FLAGS_TRUE) {
earlier = service_is(&sta, STATE_FLAGS_ISEARLIER) == STATE_FLAGS_TRUE ? 1 : 0 ;
if (!earlier) {
if (svc_scandir_send(svcandir, "h") <= 0)
log_dieu(LOG_EXIT_SYS, "reload scandir: ", svcandir) ;
......
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