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

rename ss_tree_seed_s struct to tree_seed_s

parent 0ebd554b
No related branches found
No related tags found
No related merge requests found
...@@ -60,11 +60,11 @@ static ssize_t tree_seed_get_key(char *table,char const *str) ...@@ -60,11 +60,11 @@ static ssize_t tree_seed_get_key(char *table,char const *str)
return pos ; return pos ;
} }
int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath) int tree_seed_parse_file(tree_seed_t *seed, char const *seedpath)
{ {
log_flow() ; log_flow() ;
int r ; int r, e = 0 ;
stralloc sa = STRALLOC_ZERO ; stralloc sa = STRALLOC_ZERO ;
size_t pos = 0 ; size_t pos = 0 ;
...@@ -192,7 +192,7 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath) ...@@ -192,7 +192,7 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath)
seed->nopts++ ; seed->nopts++ ;
break ; break ;
/*
case SEED_SERVICES : case SEED_SERVICES :
{ {
stralloc sv = STRALLOC_ZERO ; stralloc sv = STRALLOC_ZERO ;
...@@ -212,7 +212,7 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath) ...@@ -212,7 +212,7 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath)
break ; break ;
} }
*/
default : default :
log_warn("unknown key: ", key, " -- ignoring") ; log_warn("unknown key: ", key, " -- ignoring") ;
...@@ -221,11 +221,10 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath) ...@@ -221,11 +221,10 @@ int tree_seed_parse_file(ss_tree_seed_t *seed, char const *seedpath)
} }
stralloc_free(&sa) ; e = 1 ;
return 1 ;
err: err:
stralloc_free(&sa) ; stralloc_free(&sa) ;
return 0 ; return e ;
} }
/** @Return -1 bad format e.g want REG get DIR /** @Return -1 bad format e.g want REG get DIR
...@@ -310,16 +309,17 @@ int tree_seed_isvalid(char const *seed) ...@@ -310,16 +309,17 @@ int tree_seed_isvalid(char const *seed)
return e ; return e ;
} }
int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service) int tree_seed_ismandatory(tree_seed_t *seed, uint8_t check_service)
{ {
log_flow() ; log_flow() ;
int e = 0 ;
uid_t uid = getuid() ; uid_t uid = getuid() ;
size_t pos = 0 ; //size_t pos = 0 ;
stralloc sv = STRALLOC_ZERO ; stralloc sv = STRALLOC_ZERO ;
char *group = saseed.s + seed->group ; char *group = saseed.s + seed->group ;
char *service = saseed.s + seed->services ; //char *service = saseed.s + seed->services ;
if (!uid && (!strcmp(group, "user"))) { if (!uid && (!strcmp(group, "user"))) {
...@@ -337,7 +337,7 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service) ...@@ -337,7 +337,7 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service)
log_warn("enable was asked for a tree on group boot -- ignoring enable request") ; log_warn("enable was asked for a tree on group boot -- ignoring enable request") ;
seed->enabled = 0 ; seed->enabled = 0 ;
} }
/**
if (check_service) { if (check_service) {
stralloc sasrc = STRALLOC_ZERO ; stralloc sasrc = STRALLOC_ZERO ;
...@@ -354,7 +354,7 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service) ...@@ -354,7 +354,7 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service)
char *s = sv.s + pos ; char *s = sv.s + pos ;
/** ss_resolve_src already warn user */ // ss_resolve_src already warn user
if (!ss_resolve_src_path(&sasrc,s, uid, 0)) { if (!ss_resolve_src_path(&sasrc,s, uid, 0)) {
stralloc_free(&sasrc) ; stralloc_free(&sasrc) ;
...@@ -364,21 +364,18 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service) ...@@ -364,21 +364,18 @@ int tree_seed_ismandatory(ss_tree_seed_t *seed, uint8_t check_service)
stralloc_free(&sasrc) ; stralloc_free(&sasrc) ;
} }
*/
stralloc_free(&sv) ; e = 1 ;
return 1 ;
err: err:
stralloc_free(&sv) ; stralloc_free(&sv) ;
return 0 ; return e ;
} }
/** Return 0 on fail int tree_seed_setseed(tree_seed_t *seed, char const *treename, uint8_t check_service)
* Return 1 if tree need to be created
* Return 2 if tree already exist */
int tree_seed_setseed(ss_tree_seed_t *seed, char const *treename, uint8_t check_service)
{ {
log_flow() ; log_flow() ;
int e = 0 ;
stralloc src = STRALLOC_ZERO ; stralloc src = STRALLOC_ZERO ;
if (!tree_seed_resolve_path(&src, treename)) if (!tree_seed_resolve_path(&src, treename))
...@@ -392,9 +389,8 @@ int tree_seed_setseed(ss_tree_seed_t *seed, char const *treename, uint8_t check_ ...@@ -392,9 +389,8 @@ int tree_seed_setseed(ss_tree_seed_t *seed, char const *treename, uint8_t check_
!tree_seed_ismandatory(seed, check_service)) !tree_seed_ismandatory(seed, check_service))
goto err ; goto err ;
stralloc_free(&src) ; e = 1 ;
return 1 ;
err: err:
stralloc_free(&src) ; stralloc_free(&src) ;
return 0 ; return e ;
} }
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