summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-04-01 23:16:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-04-01 23:17:53 +0200
commit6748e6494c223b779a204b370e395f82c8e5247f (patch)
tree1a18e42803c8d6700ef8bc8d4e22552a2ff5c8b4
parentfd5fb2d2b59640910addf5c946a39d4cc5c09003 (diff)
downloadbusybox-6748e6494c223b779a204b370e395f82c8e5247f.tar.gz
hush (NOMMU): fix LINENO in execed children
function old new delta hush_main 1815 1851 +36 re_execute_shell 601 635 +34 .rodata 102721 102726 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 75/0) Total: 75 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 170edf415..a938cc790 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7468,6 +7468,9 @@ static void re_execute_shell(char ***to_free, const char *s,
if (!cur->flg_export || cur->flg_read_only)
cnt += 2;
}
+# if ENABLE_HUSH_LINENO_VAR
+ cnt += 2;
+# endif
# if ENABLE_HUSH_FUNCTIONS
for (funcp = G.top_func; funcp; funcp = funcp->next)
cnt += 3;
@@ -7489,6 +7492,10 @@ static void re_execute_shell(char ***to_free, const char *s,
*pp++ = cur->varstr;
}
}
+# if ENABLE_HUSH_LINENO_VAR
+ *pp++ = (char *) "-L";
+ *pp++ = utoa(G.execute_lineno);
+# endif
# if ENABLE_HUSH_FUNCTIONS
for (funcp = G.top_func; funcp; funcp = funcp->next) {
*pp++ = (char *) "-F";
@@ -10400,6 +10407,9 @@ int hush_main(int argc, char **argv)
"cexinsl"
#if !BB_MMU
"$:R:V:"
+# if ENABLE_HUSH_LINENO_VAR
+ "L:"
+# endif
# if ENABLE_HUSH_FUNCTIONS
"F:"
# endif
@@ -10498,6 +10508,11 @@ int hush_main(int argc, char **argv)
case 'V':
set_local_var(xstrdup(optarg), opt == 'R' ? SETFLAG_MAKE_RO : 0);
break;
+# if ENABLE_HUSH_LINENO_VAR
+ case 'L':
+ G.parse_lineno = xatou(optarg);
+ break;
+# endif
# if ENABLE_HUSH_FUNCTIONS
case 'F': {
struct function *funcp = new_function(optarg);