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

check module, change check_mandatory function call

parent b595411c
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype) ...@@ -40,7 +40,7 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype)
section_t sasection = SECTION_ZERO ; section_t sasection = SECTION_ZERO ;
genalloc ganocheck = GENALLOC_ZERO ; genalloc ganocheck = GENALLOC_ZERO ;
sasection.file = svname ; sasection.file = svname ;
r = section_get_range(&sasection,src) ; r = section_get_range(&sasection,src) ;
if (r <= 0){ if (r <= 0){
log_warnu("parse section of service file: ",svname) ; log_warnu("parse section of service file: ",svname) ;
...@@ -51,7 +51,8 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype) ...@@ -51,7 +51,8 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype)
log_warn("missing section [main] in service file: ", svname) ; log_warn("missing section [main] in service file: ", svname) ;
goto err ; goto err ;
} }
if (svtype != TYPE_BUNDLE && !sasection.idx[SECTION_START])
if ((svtype != TYPE_BUNDLE && svtype != TYPE_MODULE) && !sasection.idx[SECTION_START])
{ {
log_warn("missing section [start] in service file: ", svname) ; log_warn("missing section [start] in service file: ", svname) ;
goto err ; goto err ;
...@@ -62,19 +63,6 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype) ...@@ -62,19 +63,6 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype)
goto err ; goto err ;
} }
for (i = 0;i < genalloc_len(keynocheck,&ganocheck);i++)
{
uint32_t idsec = genalloc_s(keynocheck,&ganocheck)[i].idsec ;
for (unsigned int j = 0;j < total_list_el[idsec] && *total_list[idsec].list[j].name;j++)
{
if (!get_mandatory(&ganocheck,idsec,j))
{
log_warn("mandatory key is missing in service file: ",svname) ;
goto err ;
}
}
}
for (i = 0;i < genalloc_len(keynocheck,&ganocheck);i++) for (i = 0;i < genalloc_len(keynocheck,&ganocheck);i++)
{ {
if (!nocheck_toservice(&(genalloc_s(keynocheck,&ganocheck)[i]),svtype,service)) if (!nocheck_toservice(&(genalloc_s(keynocheck,&ganocheck)[i]),svtype,service))
...@@ -84,6 +72,8 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype) ...@@ -84,6 +72,8 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype)
} }
} }
if (!check_mandatory(service,&sasection)) goto err ;
if ((service->opts[1]) && (svtype == TYPE_LONGRUN)) if ((service->opts[1]) && (svtype == TYPE_LONGRUN))
{ {
if (!add_pipe(service, &deps)) if (!add_pipe(service, &deps))
...@@ -92,7 +82,7 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype) ...@@ -92,7 +82,7 @@ int parser(sv_alltype *service,stralloc *src,char const *svname,int svtype)
goto err ; goto err ;
} }
} }
section_free(&sasection) ; section_free(&sasection) ;
genalloc_deepfree(keynocheck,&ganocheck,keynocheck_free) ; genalloc_deepfree(keynocheck,&ganocheck,keynocheck_free) ;
return 1 ; return 1 ;
......
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