From 0b447444bbb2fd81266987ddd25382199055055a Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 27 Dec 2024 15:33:07 +0100 Subject: [PATCH] test --- src/cmd/ksh93/sh/init.c | 12 ++++++------ src/lib/libast/include/ast.h | 2 ++ src/lib/libast/port/astconf.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cmd/ksh93/sh/init.c b/src/cmd/ksh93/sh/init.c index 79e25f1426da..1b0d2f62e553 100644 --- a/src/cmd/ksh93/sh/init.c +++ b/src/cmd/ksh93/sh/init.c @@ -1207,12 +1207,6 @@ Shell_t *sh_init(int argc,char *argv[], Shinit_f userinit) sh.euserid = geteuid(); sh.groupid = getgid(); sh.egroupid = getegid(); - sh.lim.child_max = (int)astconf_long(CONF_CHILD_MAX); - sh.lim.clk_tck = (int)astconf_long(CONF_CLK_TCK); - if(sh.lim.child_max <= 0) - sh.lim.child_max = CHILD_MAX; - if(sh.lim.clk_tck <= 0) - sh.lim.clk_tck = CLK_TCK; sh.ed_context = ed_open(); error_info.id = path_basename(argv[0]); umask(sh.mask = umask(0)); @@ -1255,6 +1249,12 @@ Shell_t *sh_init(int argc,char *argv[], Shinit_f userinit) /* read the environment */ env_init(); astconfdisc(newconf); + sh.lim.child_max = (int)astconf_long(CONF_CHILD_MAX); + sh.lim.clk_tck = (int)astconf_long(CONF_CLK_TCK); + if(sh.lim.child_max <= 0) + sh.lim.child_max = CHILD_MAX; + if(sh.lim.clk_tck <= 0) + sh.lim.clk_tck = CLK_TCK; if(!ENVNOD->nvalue) { sfprintf(sh.strbuf,"%s/.kshrc",nv_getval(HOME)); diff --git a/src/lib/libast/include/ast.h b/src/lib/libast/include/ast.h index f3728a8c7b3b..babe9add9930 100644 --- a/src/lib/libast/include/ast.h +++ b/src/lib/libast/include/ast.h @@ -298,6 +298,7 @@ extern int astquery(int, const char*, ...); extern void astwinsize(int, int*, int*); #if _lib_sysconf /* prefer sysconf for astconf_long and astconf_ulong to improve performance */ +#warning using sysconf for astconf_long #define CONF_ARG_MAX _SC_ARG_MAX #define CONF_CHILD_MAX _SC_CHILD_MAX #define CONF_CLK_TCK _SC_CLK_TCK @@ -308,6 +309,7 @@ extern void astwinsize(int, int*, int*); #define astconf_ulong(x) (unsigned long)sysconf(x) #else /* fallback in case sysconf isn't available */ +#warning using astconf fallback for astconf_long #define CONF_ARG_MAX "ARG_MAX" #define CONF_CHILD_MAX "CHILD_MAX" #define CONF_CLK_TCK "CLK_TCK" diff --git a/src/lib/libast/port/astconf.c b/src/lib/libast/port/astconf.c index 2aef11aa03ca..cc0c86a0c7ad 100644 --- a/src/lib/libast/port/astconf.c +++ b/src/lib/libast/port/astconf.c @@ -320,7 +320,7 @@ synthesize(Feature_t* fp, const char* path, const char* value) char* de; char* ve; -if(getenv("_AST_DEBUG")){error(ERROR_warn(0),"[DEBUG] astconf: init state.data");abort();} +error(ERROR_warn(0),"[DEBUG] astconf: init state.data");abort(); state.prefix = strlen(state.name) + 1; n = state.prefix + 3 * MAXVAL; if ((s = getenv(state.name)) || getenv(state.strict) && (s = (char*)state.standard))