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

remove HEAP memory usage

parent 6000a006
No related branches found
No related tags found
No related merge requests found
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <oblibs/types.h> #include <oblibs/types.h>
#include <oblibs/directory.h> #include <oblibs/directory.h>
#include <skalibs/stralloc.h>
#include <66/ssexec.h> #include <66/ssexec.h>
#include <66/config.h> #include <66/config.h>
#include <66/constants.h> #include <66/constants.h>
...@@ -53,14 +51,6 @@ static void auto_check(char *dst) ...@@ -53,14 +51,6 @@ static void auto_check(char *dst)
auto_dir(dst,0755) ; auto_dir(dst,0755) ;
} }
static void inline auto_stralloc(stralloc *sa,char const *str)
{
log_flow() ;
if (!auto_stra(sa,str))
log_die_nomem("stralloc") ;
}
int sanitize_system(ssexec_t *info) int sanitize_system(ssexec_t *info)
{ {
log_flow() ; log_flow() ;
...@@ -99,41 +89,31 @@ int sanitize_system(ssexec_t *info) ...@@ -99,41 +89,31 @@ int sanitize_system(ssexec_t *info)
} else { } else {
size_t extralen ; char home[SS_MAX_PATH_LEN + 1] ;
stralloc extra = STRALLOC_ZERO ;
if (!set_ownerhome(&extra,info->owner))
log_dieusys(LOG_EXIT_SYS,"set home directory") ;
extralen = extra.len ; if (!set_ownerhome_stack(home))
if (!auto_stra(&extra, SS_USER_DIR, SS_SYSTEM)) log_dieusys(LOG_EXIT_SYS,"set home directory") ;
log_die_nomem("stralloc") ;
auto_check(extra.s) ;
extra.len = extralen ; size_t homelen = strlen(home) ;
auto_stralloc(&extra,SS_LOGGER_USERDIR) ; char target[homelen + SS_MAX_PATH_LEN + 1] ;
auto_check(extra.s) ;
extra.len = extralen ; auto_strings(target, home, SS_USER_DIR, SS_SYSTEM) ;
auto_stralloc(&extra,SS_SERVICE_USERDIR) ; auto_check(target) ;
auto_check(extra.s) ;
extra.len = extralen ; auto_strings(target + homelen, SS_LOGGER_USERDIR) ;
auto_stralloc(&extra,SS_SERVICE_USERCONFDIR) ; auto_check(target) ;
auto_check(extra.s) ;
extra.len = extralen ; auto_strings(target + homelen, SS_SERVICE_USERDIR) ;
auto_stralloc(&extra,SS_MODULE_USERDIR) ; auto_check(target) ;
auto_check(extra.s) ;
extra.len = extralen ; auto_strings(target + homelen, SS_SERVICE_USERCONFDIR) ;
auto_stralloc(&extra,SS_SCRIPT_USERDIR) ; auto_check(target) ;
auto_check(extra.s) ;
extra.len = extralen ; auto_strings(target + homelen, SS_SCRIPT_USERDIR) ;
auto_stralloc(&extra,SS_SEED_USERDIR) ; auto_check(target) ;
auto_check(extra.s) ;
stralloc_free(&extra) ; auto_strings(target + homelen, SS_SEED_USERDIR) ;
auto_check(target) ;
} }
auto_strings(dst, info->base.s, SS_SYSTEM, SS_RESOLVE, SS_SERVICE) ; auto_strings(dst, info->base.s, SS_SYSTEM, SS_RESOLVE, SS_SERVICE) ;
......
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