From 26777aa1c659b229f07205291241e45e64712a72 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Mon, 22 Nov 2010 23:49:10 +0100
Subject: fixes for bugs discovered by randomconfig builds and tests

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
 shell/ash.c  | 9 ++++++++-
 shell/hush.c | 6 ++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

(limited to 'shell')

diff --git a/shell/ash.c b/shell/ash.c
index 5ef7efbdb..5671a524b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -43,7 +43,9 @@
 #include <sys/times.h>
 
 #include "shell_common.h"
-#include "math.h"
+#if ENABLE_SH_MATH_SUPPORT
+# include "math.h"
+#endif
 #if ENABLE_ASH_RANDOM_SUPPORT
 # include "random.h"
 #else
@@ -5510,6 +5512,11 @@ static struct arglist exparg;
 /*
  * Our own itoa().
  */
+#if !ENABLE_SH_MATH_SUPPORT
+/* cvtnum() is used even if math support is off (to prepare $? values and such) */
+typedef long arith_t;
+# define ARITH_FMT "%ld"
+#endif
 static int
 cvtnum(arith_t num)
 {
diff --git a/shell/hush.c b/shell/hush.c
index da32c2435..26a50744e 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -712,11 +712,11 @@ struct globals {
 	int last_jobid;
 	pid_t saved_tty_pgrp;
 	struct pipe *job_list;
-	char o_opt[NUM_OPT_O];
 # define G_saved_tty_pgrp (G.saved_tty_pgrp)
 #else
 # define G_saved_tty_pgrp 0
 #endif
+	char o_opt[NUM_OPT_O];
 	smallint flag_SIGINT;
 #if ENABLE_HUSH_LOOPS
 	smallint flag_break_continue;
@@ -4500,7 +4500,9 @@ static struct pipe *parse_stream(char **pstring,
 	expand_string_to_string(str)
 #endif
 static char *expand_string_to_string(const char *str, int do_unbackslash);
+#if ENABLE_HUSH_TICK
 static int process_command_subs(o_string *dest, const char *s);
+#endif
 
 /* expand_strvec_to_strvec() takes a list of strings, expands
  * all variable references within and returns a pointer to
@@ -6579,7 +6581,7 @@ static int checkjobs_and_fg_shell(struct pipe *fg_pipe)
  * subshell:     ( list ) [&]
  */
 #if !ENABLE_HUSH_MODE_X
-#define redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel, char argv_expanded) \
+#define redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel, argv_expanded) \
 	redirect_and_varexp_helper(new_env_p, old_vars_p, command, squirrel)
 #endif
 static int redirect_and_varexp_helper(char ***new_env_p,
-- 
cgit v1.2.3-55-g6feb