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

what a bug framboise!

parent 002fa0a3
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> //#include <stdio.h>
#include <oblibs/string.h> #include <oblibs/string.h>
#include <oblibs/stralist.h> #include <oblibs/stralist.h>
...@@ -169,23 +169,26 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -169,23 +169,26 @@ int main (int argc, char const *const *argv, char const *const *envp)
xpathexec_run(argv[0],argv,envp) ; xpathexec_run(argv[0],argv,envp) ;
} }
} }
if (!file_readputsa(&src,path,file)) strerr_diefu4sys(111,"read file: ",path,"/",file) ; if (!file_readputsa(&src,path,file)) strerr_diefu4sys(111,"read file: ",path,"/",file) ;
if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",file) ; if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",file) ;
if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",file) ; if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",file) ;
if (genalloc_len(diuint32,&GAENV) > MAXVAR) strerr_dief4x(111,"to many variables in file: ",path,"/",file) ;
} }
else else
{ {
for (i = 0 ; i < genalloc_len(stralist,&toparse) ; i++) for (i = 0 ; i < genalloc_len(stralist,&toparse) ; i++)
{ {
src.len = 0 ; src.len = 0 ;
size_t n = i + MAXVAR ; size_t n = genalloc_len(diuint32,&GAENV) + MAXVAR ;
if (i > MAXFILE) strerr_dief2x(111,"to many file to parse in: ",path) ; if (i > MAXFILE) strerr_dief2x(111,"to many file to parse in: ",path) ;
if (!file_readputsa(&src,path,gaistr(&toparse,i))) strerr_diefu4sys(111,"read file: ",path,"/",gaistr(&toparse,i)) ; if (!file_readputsa(&src,path,gaistr(&toparse,i))) strerr_diefu4sys(111,"read file: ",path,"/",gaistr(&toparse,i)) ;
if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",gaistr(&toparse,i)) ; if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",gaistr(&toparse,i)) ;
if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",gaistr(&toparse,i)) ; if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",gaistr(&toparse,i)) ;
if (genalloc_len(stralist,&toparse) > n) strerr_dief4x(111,"to many variables in file: ",path,"/",gaistr(&toparse,i)) ; if (genalloc_len(diuint32,&GAENV) > n) strerr_dief4x(111,"to many variables in file: ",path,"/",gaistr(&toparse,i)) ;
} }
} }
genalloc_deepfree(stralist,&toparse,stra_free) ; genalloc_deepfree(stralist,&toparse,stra_free) ;
stralloc_free(&src) ; stralloc_free(&src) ;
......
...@@ -111,7 +111,6 @@ int env_split_one(char *line,genalloc *ga,stralloc *sa) ...@@ -111,7 +111,6 @@ int env_split_one(char *line,genalloc *ga,stralloc *sa)
diuint32 tmp = DIUINT32_ZERO ; diuint32 tmp = DIUINT32_ZERO ;
k = line ; k = line ;
v = line ; v = line ;
obstr_sep(&v,"=") ; obstr_sep(&v,"=") ;
if (v == NULL) return 0 ; if (v == NULL) return 0 ;
...@@ -141,7 +140,7 @@ int env_split(genalloc *gaenv,stralloc *saenv,stralloc *src) ...@@ -141,7 +140,7 @@ int env_split(genalloc *gaenv,stralloc *saenv,stralloc *src)
/** skip commented line or empty line*/ /** skip commented line or empty line*/
if (env_clean(&tmp) < 0) continue ; if (env_clean(&tmp) < 0) continue ;
if (*line) if (*line)
if (!env_split_one(line,gaenv,saenv)) goto err ; if (!env_split_one(tmp.s,gaenv,saenv)) goto err ;
} }
genalloc_deepfree(stralist,&gatmp,stra_free) ; genalloc_deepfree(stralist,&gatmp,stra_free) ;
stralloc_free(&tmp) ; stralloc_free(&tmp) ;
......
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