hush: fix build if !BASH_LINENO_VAR

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-01-19 16:00:57 +01:00
parent 6aad1ddcc9
commit b8d076b00b

View File

@ -938,9 +938,6 @@ struct globals {
#if BASH_LINENO_VAR #if BASH_LINENO_VAR
unsigned lineno; unsigned lineno;
char *lineno_var; char *lineno_var;
# define G_lineno_var G.lineno_var
#else
# define G_lineno_var ((char*)NULL)
#endif #endif
struct FILE_list *FILE_list; struct FILE_list *FILE_list;
/* Which signals have non-DFL handler (even with no traps set)? /* Which signals have non-DFL handler (even with no traps set)?
@ -6551,13 +6548,17 @@ static void parse_and_run_string(const char *s)
static void parse_and_run_file(FILE *f) static void parse_and_run_file(FILE *f)
{ {
struct in_str input; struct in_str input;
#if BASH_LINENO_VAR
unsigned sv; unsigned sv;
setup_file_in_str(&input, f);
sv = G.lineno; sv = G.lineno;
G.lineno = 1; G.lineno = 1;
#endif
setup_file_in_str(&input, f);
parse_and_run_stream(&input, ';'); parse_and_run_stream(&input, ';');
#if BASH_LINENO_VAR
G.lineno = sv; G.lineno = sv;
#endif
} }
#if ENABLE_HUSH_TICK #if ENABLE_HUSH_TICK
@ -8104,8 +8105,10 @@ static NOINLINE int run_pipe(struct pipe *pi)
char **new_env = NULL; char **new_env = NULL;
struct variable *old_vars = NULL; struct variable *old_vars = NULL;
if (G_lineno_var) #if BASH_LINENO_VAR
strcpy(G_lineno_var + sizeof("LINENO=")-1, utoa(command->lineno)); if (G.lineno_var)
strcpy(G.lineno_var + sizeof("LINENO=")-1, utoa(command->lineno));
#endif
if (argv[command->assignment_cnt] == NULL) { if (argv[command->assignment_cnt] == NULL) {
/* Assignments, but no command */ /* Assignments, but no command */
@ -8311,8 +8314,10 @@ static NOINLINE int run_pipe(struct pipe *pi)
if (cmd_no < pi->num_cmds) if (cmd_no < pi->num_cmds)
xpiped_pair(pipefds); xpiped_pair(pipefds);
if (G_lineno_var) #if BASH_LINENO_VAR
strcpy(G_lineno_var + sizeof("LINENO=")-1, utoa(command->lineno)); if (G.lineno_var)
strcpy(G.lineno_var + sizeof("LINENO=")-1, utoa(command->lineno));
#endif
command->pid = BB_MMU ? fork() : vfork(); command->pid = BB_MMU ? fork() : vfork();
if (!command->pid) { /* child */ if (!command->pid) { /* child */