summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-05-15 21:30:45 +0000
committerDenis Vlasenko2008-05-15 21:30:45 +0000
commit6b06cb80be64fcf207bee734cc678c25434ed1a4 (patch)
treeaebc37ae3a2658fba3f57003102fa0dfb1a10ac8 /shell/ash.c
parent43d5d429fd7a80ca02eb8388f058fd9654cc118d (diff)
downloadbusybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.zip
busybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.gz
more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs. function old new delta syslogd_main 938 958 +20 get_signum 136 143 +7 obj_load 777 782 +5 recv_from_to 210 214 +4 get_next_block 1795 1799 +4 display_topmem_process_list 1117 1121 +4 logread_main 484 487 +3 buffer_fill_and_print 73 76 +3 kill_main 687 689 +2 ll_remember_index 240 241 +1 do_stats 452 453 +1 if_readconf 166 165 -1 display_process_list 1192 1191 -1 run_applet_and_exit 507 505 -2 print_signames 33 31 -2 parse_one_line 1092 1090 -2 find_out_spec 57 55 -2 add_ksymoops_symbols 421 419 -2 ash_main 1407 1402 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 200e2d4..e149070 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -1790,7 +1790,7 @@ extern struct globals_var *const ash_ptr_to_globals_var;
#define vartab (G_var.vartab )
#define varinit (G_var.varinit )
#define INIT_G_var() do { \
- int i; \
+ unsigned i; \
(*(struct globals_var**)&ash_ptr_to_globals_var) = xzalloc(sizeof(G_var)); \
barrier(); \
for (i = 0; i < ARRAY_SIZE(varinit_data); i++) { \
@@ -6223,7 +6223,7 @@ varvalue(char *name, int varflags, int flags, struct strlist *var_str_list)
if (!eq) /* stop at first non-assignment */
break;
eq++;
- if (name_len == (eq - str)
+ if (name_len == (unsigned)(eq - str)
&& strncmp(str, name, name_len) == 0) {
p = eq;
/* goto value; - WRONG! */
@@ -9500,12 +9500,13 @@ plus_minus_o(char *name, int val)
ash_msg("illegal option %co %s", val ? '-' : '+', name);
return 1;
}
- for (i = 0; i < NOPTS; i++)
+ for (i = 0; i < NOPTS; i++) {
if (val) {
out1fmt("%-16s%s\n", optnames(i), optlist[i] ? "on" : "off");
} else {
out1fmt("set %co %s\n", optlist[i] ? '-' : '+', optnames(i));
}
+ }
return 0;
}
static void
@@ -9699,7 +9700,7 @@ getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *opt
return 1;
optnext = optfirst + *param_optind - 1;
- if (*param_optind <= 1 || *optoff < 0 || strlen(optnext[-1]) < *optoff)
+ if (*param_optind <= 1 || *optoff < 0 || (int)strlen(optnext[-1]) < *optoff)
p = NULL;
else
p = optnext[-1] + *optoff;
@@ -11121,7 +11122,7 @@ xxreadtoken(void)
return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
}
- if (p - xxreadtoken_chars >= xxreadtoken_singles) {
+ if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
if (pgetc() == *p) { /* double occurrence? */
p += xxreadtoken_doubles + 1;
} else {
@@ -11817,7 +11818,8 @@ trapcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
static int
helpcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{
- int col, i;
+ unsigned col;
+ unsigned i;
out1fmt("\nBuilt-in commands:\n-------------------\n");
for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) {
@@ -12479,6 +12481,7 @@ ulimitcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
while ((c = *p++) >= '0' && c <= '9') {
val = (val * 10) + (long)(c - '0');
+ // val is actually 'unsigned long int' and can't get < 0
if (val < (rlim_t) 0)
break;
}