*: style fixes. no code changes (verified with objdump)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-01-28 02:24:24 +01:00
parent 17323a6245
commit 6b9f163353
23 changed files with 231 additions and 160 deletions

View File

@ -393,10 +393,12 @@ int BZ2_bzBuffToBuffCompress(char* dest,
bz_stream strm; bz_stream strm;
int ret; int ret;
if (dest == NULL || destLen == NULL || if (dest == NULL || destLen == NULL
source == NULL || || source == NULL
blockSize100k < 1 || blockSize100k > 9) || blockSize100k < 1 || blockSize100k > 9
) {
return BZ_PARAM_ERROR; return BZ_PARAM_ERROR;
}
BZ2_bzCompressInit(&strm, blockSize100k); BZ2_bzCompressInit(&strm, blockSize100k);

View File

@ -858,8 +858,9 @@ static void write_status_file(deb_file_t **deb_file)
if (field_name == NULL) { if (field_name == NULL) {
break; break;
} }
if ((strcmp(field_name, "Priority") == 0) || if ((strcmp(field_name, "Priority") == 0)
(strcmp(field_name, "Section") == 0)) { || (strcmp(field_name, "Section") == 0)
) {
fprintf(new_status_file, "%s: %s\n", field_name, field_value); fprintf(new_status_file, "%s: %s\n", field_name, field_value);
} }
} }
@ -1079,8 +1080,9 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator); package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator);
if (package_edge->type == EDGE_PRE_DEPENDS || if (package_edge->type == EDGE_PRE_DEPENDS
package_edge->type == EDGE_DEPENDS) { || package_edge->type == EDGE_DEPENDS
) {
int result=1; int result=1;
status_num = 0; status_num = 0;

View File

@ -620,10 +620,12 @@ static int longest_match(IPos cur_match)
/* Skip to next match if the match length cannot increase /* Skip to next match if the match length cannot increase
* or if the match length is less than 2: * or if the match length is less than 2:
*/ */
if (match[best_len] != scan_end || if (match[best_len] != scan_end
match[best_len - 1] != scan_end1 || || match[best_len - 1] != scan_end1
*match != *scan || *++match != scan[1]) || *match != *scan || *++match != scan[1]
) {
continue; continue;
}
/* The check at best_len-1 can be removed because it will be made /* The check at best_len-1 can be removed because it will be made
* again later. (This heuristic is not always a win.) * again later. (This heuristic is not always a win.)

View File

@ -176,7 +176,7 @@ static int swd_init(lzo_swd_p s)
if (s->look > 0) { if (s->look > 0) {
if (s->look > SWD_F) if (s->look > SWD_F)
s->look = SWD_F; s->look = SWD_F;
memcpy(&s->b[s->ip],s->c->ip,s->look); memcpy(&s->b[s->ip], s->c->ip, s->look);
s->c->ip += s->look; s->c->ip += s->look;
s->ip += s->look; s->ip += s->look;
} }
@ -256,8 +256,8 @@ static void swd_accept(lzo_swd_p s, unsigned n)
swd_remove_node(s,s->rp); swd_remove_node(s,s->rp);
/* add bp into HEAD3 */ /* add bp into HEAD3 */
key = HEAD3(s->b,s->bp); key = HEAD3(s->b, s->bp);
s->succ3[s->bp] = s_get_head3(s,key); s->succ3[s->bp] = s_get_head3(s, key);
s->head3[key] = s->bp; s->head3[key] = s->bp;
s->best3[s->bp] = SWD_F + 1; s->best3[s->bp] = SWD_F + 1;
s->llen3[key]++; s->llen3[key]++;
@ -265,7 +265,7 @@ static void swd_accept(lzo_swd_p s, unsigned n)
#ifdef HEAD2 #ifdef HEAD2
/* add bp into HEAD2 */ /* add bp into HEAD2 */
key = HEAD2(s->b,s->bp); key = HEAD2(s->b, s->bp);
s->head2[key] = s->bp; s->head2[key] = s->bp;
#endif #endif
@ -298,18 +298,19 @@ static void swd_search(lzo_swd_p s, unsigned node, unsigned cnt)
assert(m_len < s->look); assert(m_len < s->look);
if (p2[m_len - 1] == scan_end1 && if (p2[m_len - 1] == scan_end1
p2[m_len] == p1[m_len] && && p2[m_len] == p1[m_len]
p2[0] == p1[0] && && p2[0] == p1[0]
p2[1] == p1[1]) { && p2[1] == p1[1]
) {
unsigned i; unsigned i;
assert(lzo_memcmp(bp,&b[node],3) == 0); assert(lzo_memcmp(bp, &b[node], 3) == 0);
p1 += 2; p2 += 2; p1 += 2; p2 += 2;
do {} while (++p1 < px && *p1 == *++p2); do {} while (++p1 < px && *p1 == *++p2);
i = p1-bp; i = p1-bp;
assert(lzo_memcmp(bp,&b[node],i) == 0); assert(lzo_memcmp(bp, &b[node], i) == 0);
#if defined(SWD_BEST_OFF) #if defined(SWD_BEST_OFF)
if (i < SWD_BEST_OFF) { if (i < SWD_BEST_OFF) {
@ -345,10 +346,10 @@ static int swd_search2(lzo_swd_p s)
assert(s->look >= 2); assert(s->look >= 2);
assert(s->m_len > 0); assert(s->m_len > 0);
key = s->head2[ HEAD2(s->b,s->bp) ]; key = s->head2[HEAD2(s->b, s->bp)];
if (key == NIL2) if (key == NIL2)
return 0; return 0;
assert(lzo_memcmp(&s->b[s->bp],&s->b[key],2) == 0); assert(lzo_memcmp(&s->b[s->bp], &s->b[key], 2) == 0);
#if defined(SWD_BEST_OFF) #if defined(SWD_BEST_OFF)
if (s->best_pos[2] == 0) if (s->best_pos[2] == 0)
s->best_pos[2] = key + 1; s->best_pos[2] = key + 1;
@ -377,7 +378,7 @@ static void swd_findbest(lzo_swd_p s)
/* get current head, add bp into HEAD3 */ /* get current head, add bp into HEAD3 */
key = HEAD3(s->b,s->bp); key = HEAD3(s->b,s->bp);
node = s->succ3[s->bp] = s_get_head3(s,key); node = s->succ3[s->bp] = s_get_head3(s, key);
cnt = s->llen3[key]++; cnt = s->llen3[key]++;
assert(s->llen3[key] <= SWD_N + SWD_F); assert(s->llen3[key] <= SWD_N + SWD_F);
if (cnt > s->max_chain) if (cnt > s->max_chain)
@ -396,7 +397,7 @@ static void swd_findbest(lzo_swd_p s)
if (swd_search2(s)) if (swd_search2(s))
#endif #endif
if (s->look >= 3) if (s->look >= 3)
swd_search(s,node,cnt); swd_search(s, node, cnt);
if (s->m_len > len) if (s->m_len > len)
s->m_off = swd_pos2off(s,s->m_pos); s->m_off = swd_pos2off(s,s->m_pos);
s->best3[s->bp] = s->m_len; s->best3[s->bp] = s->m_len;
@ -404,12 +405,13 @@ static void swd_findbest(lzo_swd_p s)
#if defined(SWD_BEST_OFF) #if defined(SWD_BEST_OFF)
if (s->use_best_off) { if (s->use_best_off) {
int i; int i;
for (i = 2; i < SWD_BEST_OFF; i++) for (i = 2; i < SWD_BEST_OFF; i++) {
if (s->best_pos[i] > 0) if (s->best_pos[i] > 0)
s->best_off[i] = swd_pos2off(s,s->best_pos[i]-1); s->best_off[i] = swd_pos2off(s, s->best_pos[i]-1);
else else
s->best_off[i] = 0; s->best_off[i] = 0;
} }
}
#endif #endif
} }
@ -417,7 +419,7 @@ static void swd_findbest(lzo_swd_p s)
#ifdef HEAD2 #ifdef HEAD2
/* add bp into HEAD2 */ /* add bp into HEAD2 */
key = HEAD2(s->b,s->bp); key = HEAD2(s->b, s->bp);
s->head2[key] = s->bp; s->head2[key] = s->bp;
#endif #endif
} }
@ -467,7 +469,7 @@ static int find_match(lzo1x_999_t *c, lzo_swd_p s,
s->m_len = 1; s->m_len = 1;
#ifdef SWD_BEST_OFF #ifdef SWD_BEST_OFF
if (s->use_best_off) if (s->use_best_off)
memset(s->best_pos,0,sizeof(s->best_pos)); memset(s->best_pos, 0, sizeof(s->best_pos));
#endif #endif
swd_findbest(s); swd_findbest(s);
c->m_len = s->m_len; c->m_len = s->m_len;
@ -505,7 +507,8 @@ static uint8_t *code_match(lzo1x_999_t *c,
assert(op > c->out); assert(op > c->out);
if (m_len == 2) { if (m_len == 2) {
assert(m_off <= M1_MAX_OFFSET); assert(m_off <= M1_MAX_OFFSET);
assert(c->r1_lit > 0); assert(c->r1_lit < 4); assert(c->r1_lit > 0);
assert(c->r1_lit < 4);
m_off -= 1; m_off -= 1;
*op++ = M1_MARKER | ((m_off & 3) << 2); *op++ = M1_MARKER | ((m_off & 3) << 2);
*op++ = m_off >> 2; *op++ = m_off >> 2;
@ -529,8 +532,7 @@ static uint8_t *code_match(lzo1x_999_t *c,
else { else {
m_len -= M3_MAX_LEN; m_len -= M3_MAX_LEN;
*op++ = M3_MARKER | 0; *op++ = M3_MARKER | 0;
while (m_len > 255) while (m_len > 255) {
{
m_len -= 255; m_len -= 255;
*op++ = 0; *op++ = 0;
} }
@ -543,7 +545,8 @@ static uint8_t *code_match(lzo1x_999_t *c,
unsigned k; unsigned k;
assert(m_len >= 3); assert(m_len >= 3);
assert(m_off > 0x4000); assert(m_off <= 0xbfff); assert(m_off > 0x4000);
assert(m_off <= 0xbfff);
m_off -= 0x4000; m_off -= 0x4000;
k = (m_off & 0x4000) >> 11; k = (m_off & 0x4000) >> 11;
if (m_len <= M4_MAX_LEN) if (m_len <= M4_MAX_LEN)
@ -551,8 +554,7 @@ static uint8_t *code_match(lzo1x_999_t *c,
else { else {
m_len -= M4_MAX_LEN; m_len -= M4_MAX_LEN;
*op++ = M4_MARKER | k | 0; *op++ = M4_MARKER | k | 0;
while (m_len > 255) while (m_len > 255) {
{
m_len -= 255; m_len -= 255;
*op++ = 0; *op++ = 0;
} }
@ -598,7 +600,7 @@ static uint8_t *code_run(lzo1x_999_t *c, uint8_t *op, const uint8_t *ii,
{ {
if (lit > 0) { if (lit > 0) {
assert(m_len >= 2); assert(m_len >= 2);
op = STORE_RUN(c,op,ii,lit); op = STORE_RUN(c, op, ii, lit);
} else { } else {
assert(m_len >= 3); assert(m_len >= 3);
} }
@ -681,29 +683,29 @@ static void better_match(const lzo_swd_p swd,
return; return;
/* M3/M4 -> M2 */ /* M3/M4 -> M2 */
if (*m_off > M2_MAX_OFFSET && if (*m_off > M2_MAX_OFFSET
*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 && && *m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET) && swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET
{ ) {
*m_len = *m_len - 1; *m_len = *m_len - 1;
*m_off = swd->best_off[*m_len]; *m_off = swd->best_off[*m_len];
return; return;
} }
/* M4 -> M2 */ /* M4 -> M2 */
if (*m_off > M3_MAX_OFFSET && if (*m_off > M3_MAX_OFFSET
*m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 && && *m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2
swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET) && swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET
{ ) {
*m_len = *m_len - 2; *m_len = *m_len - 2;
*m_off = swd->best_off[*m_len]; *m_off = swd->best_off[*m_len];
return; return;
} }
/* M4 -> M3 */ /* M4 -> M3 */
if (*m_off > M3_MAX_OFFSET && if (*m_off > M3_MAX_OFFSET
*m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 && && *m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET) && swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET
{ ) {
*m_len = *m_len - 1; *m_len = *m_len - 1;
*m_off = swd->best_off[*m_len]; *m_off = swd->best_off[*m_len];
} }
@ -728,8 +730,8 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
unsigned lit; unsigned lit;
unsigned m_len, m_off; unsigned m_len, m_off;
lzo1x_999_t cc; lzo1x_999_t cc;
lzo1x_999_t * const c = &cc; lzo1x_999_t *const c = &cc;
lzo_swd_p const swd = (lzo_swd_p) wrkmem; const lzo_swd_p swd = (lzo_swd_p) wrkmem;
int r; int r;
c->init = 0; c->init = 0;
@ -766,15 +768,15 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
assert(ii + lit == c->bp); assert(ii + lit == c->bp);
assert(swd->b_char == *(c->bp)); assert(swd->b_char == *(c->bp));
if ( m_len < 2 || if (m_len < 2
(m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) || || (m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4))
/* Do not accept this match for compressed-data compatibility /* Do not accept this match for compressed-data compatibility
* with LZO v1.01 and before * with LZO v1.01 and before
* [ might be a problem for decompress() and optimize() ] * [ might be a problem for decompress() and optimize() ]
*/ */
(m_len == 2 && op == out) || || (m_len == 2 && op == out)
(op == out && lit == 0)) || (op == out && lit == 0)
{ ) {
/* a literal */ /* a literal */
m_len = 0; m_len = 0;
} }
@ -788,7 +790,7 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
/* a literal */ /* a literal */
lit++; lit++;
swd->max_chain = max_chain; swd->max_chain = max_chain;
r = find_match(c,swd,1,0); r = find_match(c, swd, 1, 0);
assert(r == 0); assert(r == 0);
continue; continue;
} }
@ -796,7 +798,7 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
/* a match */ /* a match */
#if defined(SWD_BEST_OFF) #if defined(SWD_BEST_OFF)
if (swd->use_best_off) if (swd->use_best_off)
better_match(swd,&m_len,&m_off); better_match(swd, &m_len, &m_off);
#endif #endif
/* shall we try a lazy match ? */ /* shall we try a lazy match ? */
@ -807,7 +809,7 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
max_ahead = 0; max_ahead = 0;
} else { } else {
/* yes, try a lazy match */ /* yes, try a lazy match */
l1 = len_of_coded_match(m_len,m_off,lit); l1 = len_of_coded_match(m_len, m_off, lit);
assert(l1 > 0); assert(l1 > 0);
max_ahead = LZO_MIN(2, (unsigned)l1 - 1); max_ahead = LZO_MIN(2, (unsigned)l1 - 1);
} }
@ -820,7 +822,7 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
swd->max_chain = max_chain >> 2; swd->max_chain = max_chain >> 2;
else else
swd->max_chain = max_chain; swd->max_chain = max_chain;
r = find_match(c,swd,1,0); r = find_match(c, swd, 1, 0);
ahead++; ahead++;
assert(r == 0); assert(r == 0);
@ -833,23 +835,23 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
continue; continue;
#if defined(SWD_BEST_OFF) #if defined(SWD_BEST_OFF)
if (swd->use_best_off) if (swd->use_best_off)
better_match(swd,&c->m_len,&c->m_off); better_match(swd, &c->m_len, &c->m_off);
#endif #endif
l2 = len_of_coded_match(c->m_len,c->m_off,lit+ahead); l2 = len_of_coded_match(c->m_len, c->m_off, lit+ahead);
if (l2 < 0) if (l2 < 0)
continue; continue;
/* compressed-data compatibility [see above] */ /* compressed-data compatibility [see above] */
l3 = (op == out) ? -1 : len_of_coded_match(ahead,m_off,lit); l3 = (op == out) ? -1 : len_of_coded_match(ahead, m_off, lit);
lazy_match_min_gain = min_gain(ahead,lit,lit+ahead,l1,l2,l3); lazy_match_min_gain = min_gain(ahead, lit, lit+ahead, l1, l2, l3);
if (c->m_len >= m_len + lazy_match_min_gain) { if (c->m_len >= m_len + lazy_match_min_gain) {
if (l3 > 0) { if (l3 > 0) {
/* code previous run */ /* code previous run */
op = code_run(c,op,ii,lit); op = code_run(c, op, ii, lit);
lit = 0; lit = 0;
/* code shortened match */ /* code shortened match */
op = code_match(c,op,ahead,m_off); op = code_match(c, op, ahead, m_off);
} else { } else {
lit += ahead; lit += ahead;
assert(ii + lit == c->bp); assert(ii + lit == c->bp);
@ -861,13 +863,13 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
assert(ii + lit + ahead == c->bp); assert(ii + lit + ahead == c->bp);
/* 1 - code run */ /* 1 - code run */
op = code_run(c,op,ii,lit); op = code_run(c, op, ii, lit);
lit = 0; lit = 0;
/* 2 - code match */ /* 2 - code match */
op = code_match(c,op,m_len,m_off); op = code_match(c, op, m_len, m_off);
swd->max_chain = max_chain; swd->max_chain = max_chain;
r = find_match(c,swd,m_len,1+ahead); r = find_match(c, swd, m_len, 1+ahead);
assert(r == 0); assert(r == 0);
lazy_match_done: ; lazy_match_done: ;
@ -875,7 +877,7 @@ static int lzo1x_999_compress_internal(const uint8_t *in, unsigned in_len,
/* store final run */ /* store final run */
if (lit > 0) if (lit > 0)
op = STORE_RUN(c,op,ii,lit); op = STORE_RUN(c, op, ii, lit);
#if defined(LZO_EOF_CODE) #if defined(LZO_EOF_CODE)
*op++ = M4_MARKER | 1; *op++ = M4_MARKER | 1;

View File

@ -166,9 +166,12 @@ static NOINLINE int lzo1x_optimize(uint8_t *in, unsigned in_len,
o_m1_a++; o_m1_a++;
} }
/* test if a literal run follows */ /* test if a literal run follows */
else if (nl == 0 && ip[0] < 16 && ip[0] != 0 && else
(lit + 2 + ip[0] < 16)) if (nl == 0
{ && ip[0] < 16
&& ip[0] != 0
&& (lit + 2 + ip[0] < 16)
) {
t = *ip++; t = *ip++;
/* remove short run */ /* remove short run */
*litp &= ~3; *litp &= ~3;

View File

@ -301,11 +301,14 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
if (ftruncate(ofd, seek * obs) < 0) { if (ftruncate(ofd, seek * obs) < 0) {
struct stat st; struct stat st;
if (fstat(ofd, &st) < 0 || S_ISREG(st.st_mode) || if (fstat(ofd, &st) < 0
S_ISDIR(st.st_mode)) || S_ISREG(st.st_mode)
|| S_ISDIR(st.st_mode)
) {
goto die_outfile; goto die_outfile;
} }
} }
}
} else { } else {
outfile = bb_msg_standard_output; outfile = bb_msg_standard_output;
} }

View File

@ -1158,9 +1158,11 @@ static void colon(char *buf)
file_modified = 0; file_modified = 0;
last_file_modified = -1; last_file_modified = -1;
} }
if ((cmd[0] == 'x' || cmd[1] == 'q' || cmd[1] == 'n' || if ((cmd[0] == 'x' || cmd[1] == 'q' || cmd[1] == 'n'
cmd[0] == 'X' || cmd[1] == 'Q' || cmd[1] == 'N') || cmd[0] == 'X' || cmd[1] == 'Q' || cmd[1] == 'N'
&& l == ch) { )
&& l == ch
) {
editing = 0; editing = 0;
} }
} }

View File

@ -80,9 +80,11 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA
&& strncmp(ptr, "__ksymtab_", 10) == 0 && strncmp(ptr, "__ksymtab_", 10) == 0
) { ) {
ptr += 10; ptr += 10;
if (strncmp(ptr, "gpl", 3) == 0 || if (strncmp(ptr, "gpl", 3) == 0
strcmp(ptr, "strings") == 0) || strcmp(ptr, "strings") == 0
) {
continue; continue;
}
llist_add_to(&info->symbols, xstrdup(ptr)); llist_add_to(&info->symbols, xstrdup(ptr));
ptr += strlen(ptr); ptr += strlen(ptr);
} }

View File

@ -865,19 +865,23 @@ arch_apply_relocation(struct obj_file *f,
break; break;
case R_H8_PCREL16: case R_H8_PCREL16:
v -= dot + 2; v -= dot + 2;
if ((ElfW(Sword))v > 0x7fff || if ((ElfW(Sword))v > 0x7fff
(ElfW(Sword))v < -(ElfW(Sword))0x8000) || (ElfW(Sword))v < -(ElfW(Sword))0x8000
) {
ret = obj_reloc_overflow; ret = obj_reloc_overflow;
else } else {
*(unsigned short *)loc = v; *(unsigned short *)loc = v;
}
break; break;
case R_H8_PCREL8: case R_H8_PCREL8:
v -= dot + 1; v -= dot + 1;
if ((ElfW(Sword))v > 0x7f || if ((ElfW(Sword))v > 0x7f
(ElfW(Sword))v < -(ElfW(Sword))0x80) || (ElfW(Sword))v < -(ElfW(Sword))0x80
) {
ret = obj_reloc_overflow; ret = obj_reloc_overflow;
else } else {
*(unsigned char *)loc = v; *(unsigned char *)loc = v;
}
break; break;
#elif defined(__i386__) #elif defined(__i386__)

View File

@ -163,20 +163,27 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
memset(tb, 0, sizeof(tb)); memset(tb, 0, sizeof(tb));
parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);
if (G_filter.rdst.family && inet_addr_match(&dst, &G_filter.rdst, G_filter.rdst.bitlen)) if (G_filter.rdst.family
&& inet_addr_match(&dst, &G_filter.rdst, G_filter.rdst.bitlen)
) {
return 0; return 0;
if (G_filter.mdst.family && G_filter.mdst.bitlen >= 0 && }
inet_addr_match(&dst, &G_filter.mdst, r->rtm_dst_len)) if (G_filter.mdst.family
&& G_filter.mdst.bitlen >= 0
&& inet_addr_match(&dst, &G_filter.mdst, r->rtm_dst_len)
) {
return 0; return 0;
}
if (G_filter.rsrc.family && inet_addr_match(&src, &G_filter.rsrc, G_filter.rsrc.bitlen)) if (G_filter.rsrc.family
&& inet_addr_match(&src, &G_filter.rsrc, G_filter.rsrc.bitlen)
) {
return 0; return 0;
}
if (G_filter.msrc.family && G_filter.msrc.bitlen >= 0 if (G_filter.msrc.family && G_filter.msrc.bitlen >= 0
&& inet_addr_match(&src, &G_filter.msrc, r->rtm_src_len) && inet_addr_match(&src, &G_filter.msrc, r->rtm_src_len)
) { ) {
return 0; return 0;
} }
if (G_filter.flushb if (G_filter.flushb
&& r->rtm_family == AF_INET6 && r->rtm_family == AF_INET6
&& r->rtm_dst_len == 0 && r->rtm_dst_len == 0

View File

@ -233,7 +233,8 @@ static int iprule_modify(int cmd, char **argv)
addattr_l(&req.n, sizeof(req), RTA_DST, &dst.data, dst.bytelen); addattr_l(&req.n, sizeof(req), RTA_DST, &dst.data, dst.bytelen);
} else if (key == ARG_preference || } else if (key == ARG_preference ||
key == ARG_order || key == ARG_order ||
key == ARG_priority) { key == ARG_priority
) {
uint32_t pref; uint32_t pref;
NEXT_ARG(); NEXT_ARG();
pref = get_u32(*argv, "preference"); pref = get_u32(*argv, "preference");
@ -256,7 +257,8 @@ static int iprule_modify(int cmd, char **argv)
invarg(*argv, "realms"); invarg(*argv, "realms");
addattr32(&req.n, sizeof(req), RTA_FLOW, realm); addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
} else if (key == ARG_table || } else if (key == ARG_table ||
key == ARG_lookup) { key == ARG_lookup
) {
uint32_t tid; uint32_t tid;
NEXT_ARG(); NEXT_ARG();
if (rtnl_rttable_a2n(&tid, *argv)) if (rtnl_rttable_a2n(&tid, *argv))
@ -264,11 +266,13 @@ static int iprule_modify(int cmd, char **argv)
req.r.rtm_table = tid; req.r.rtm_table = tid;
table_ok = 1; table_ok = 1;
} else if (key == ARG_dev || } else if (key == ARG_dev ||
key == ARG_iif) { key == ARG_iif
) {
NEXT_ARG(); NEXT_ARG();
addattr_l(&req.n, sizeof(req), RTA_IIF, *argv, strlen(*argv)+1); addattr_l(&req.n, sizeof(req), RTA_IIF, *argv, strlen(*argv)+1);
} else if (key == ARG_nat || } else if (key == ARG_nat ||
key == ARG_map_to) { key == ARG_map_to
) {
NEXT_ARG(); NEXT_ARG();
addattr32(&req.n, sizeof(req), RTA_GATEWAY, get_addr32(*argv)); addattr32(&req.n, sizeof(req), RTA_GATEWAY, get_addr32(*argv));
req.r.rtm_type = RTN_NAT; req.r.rtm_type = RTN_NAT;

View File

@ -204,19 +204,22 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
NEXT_ARG(); NEXT_ARG();
key = index_in_strings(keywords, *argv); key = index_in_strings(keywords, *argv);
if (key == ARG_ipip || if (key == ARG_ipip ||
key == ARG_ip_ip) { key == ARG_ip_ip
) {
if (p->iph.protocol && p->iph.protocol != IPPROTO_IPIP) { if (p->iph.protocol && p->iph.protocol != IPPROTO_IPIP) {
bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one"); bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one");
} }
p->iph.protocol = IPPROTO_IPIP; p->iph.protocol = IPPROTO_IPIP;
} else if (key == ARG_gre || } else if (key == ARG_gre ||
key == ARG_gre_ip) { key == ARG_gre_ip
) {
if (p->iph.protocol && p->iph.protocol != IPPROTO_GRE) { if (p->iph.protocol && p->iph.protocol != IPPROTO_GRE) {
bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one"); bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one");
} }
p->iph.protocol = IPPROTO_GRE; p->iph.protocol = IPPROTO_GRE;
} else if (key == ARG_sit || } else if (key == ARG_sit ||
key == ARG_ip6_ip) { key == ARG_ip6_ip
) {
if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) { if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) {
bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one"); bb_error_msg_and_die("%s tunnel mode", "you managed to ask for more than one");
} }
@ -297,7 +300,8 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
p->iph.ttl = uval; p->iph.ttl = uval;
} }
} else if (key == ARG_tos || } else if (key == ARG_tos ||
key == ARG_dsfield) { key == ARG_dsfield
) {
uint32_t uval; uint32_t uval;
NEXT_ARG(); NEXT_ARG();
key = index_in_strings(keywords, *argv); key = index_in_strings(keywords, *argv);
@ -485,7 +489,8 @@ static void do_tunnels_list(struct ip_tunnel_parm *p)
/*buf[sizeof(buf) - 1] = 0; - fgets is safe anyway */ /*buf[sizeof(buf) - 1] = 0; - fgets is safe anyway */
ptr = strchr(buf, ':'); ptr = strchr(buf, ':');
if (ptr == NULL || if (ptr == NULL ||
(*ptr++ = 0, sscanf(buf, "%s", name) != 1)) { (*ptr++ = 0, sscanf(buf, "%s", name) != 1)
) {
bb_error_msg("wrong format of /proc/net/dev"); bb_error_msg("wrong format of /proc/net/dev");
return; return;
} }
@ -511,8 +516,10 @@ static void do_tunnels_list(struct ip_tunnel_parm *p)
(p->name[0] && strcmp(p1.name, p->name)) || (p->name[0] && strcmp(p1.name, p->name)) ||
(p->iph.daddr && p1.iph.daddr != p->iph.daddr) || (p->iph.daddr && p1.iph.daddr != p->iph.daddr) ||
(p->iph.saddr && p1.iph.saddr != p->iph.saddr) || (p->iph.saddr && p1.iph.saddr != p->iph.saddr) ||
(p->i_key && p1.i_key != p->i_key)) (p->i_key && p1.i_key != p->i_key)
) {
continue; continue;
}
print_tunnel(&p1); print_tunnel(&p1);
bb_putchar('\n'); bb_putchar('\n');
} }

View File

@ -147,7 +147,8 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
if (nladdr.nl_pid != 0 || if (nladdr.nl_pid != 0 ||
h->nlmsg_pid != rth->local.nl_pid || h->nlmsg_pid != rth->local.nl_pid ||
h->nlmsg_seq != rth->dump) { h->nlmsg_seq != rth->dump
) {
// if (junk) { // if (junk) {
// err = junk(&nladdr, h, arg2); // err = junk(&nladdr, h, arg2);
// if (err < 0) { // if (err < 0) {
@ -281,7 +282,8 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
if (nladdr.nl_pid != peer || if (nladdr.nl_pid != peer ||
h->nlmsg_pid != rtnl->local.nl_pid || h->nlmsg_pid != rtnl->local.nl_pid ||
h->nlmsg_seq != seq) { h->nlmsg_seq != seq
) {
// if (junk) { // if (junk) {
// l_err = junk(&nladdr, h, jarg); // l_err = junk(&nladdr, h, jarg);
// if (l_err < 0) { // if (l_err < 0) {

View File

@ -22,8 +22,9 @@ const char* FAST_FUNC ll_addr_n2a(unsigned char *addr, int alen, int type, char
int i; int i;
int l; int l;
if (alen == 4 && if (alen == 4
(type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) { && (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)
) {
return inet_ntop(AF_INET, addr, buf, blen); return inet_ntop(AF_INET, addr, buf, blen);
} }
l = 0; l = 0;

View File

@ -470,17 +470,22 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
msg.tcm_ifindex = xll_name_to_index(dev); msg.tcm_ifindex = xll_name_to_index(dev);
if (cmd >= CMD_show) if (cmd >= CMD_show)
filter_ifindex = msg.tcm_ifindex; filter_ifindex = msg.tcm_ifindex;
} else if ((arg == ARG_qdisc && obj == OBJ_class && cmd >= CMD_show) } else
|| (arg == ARG_handle && obj == OBJ_qdisc if ((arg == ARG_qdisc && obj == OBJ_class && cmd >= CMD_show)
&& cmd == CMD_change)) { || (arg == ARG_handle && obj == OBJ_qdisc && cmd == CMD_change)
) {
NEXT_ARG(); NEXT_ARG();
/* We don't care about duparg2("qdisc handle",*argv) for now */ /* We don't care about duparg2("qdisc handle",*argv) for now */
if (get_qdisc_handle(&filter_qdisc, *argv)) if (get_qdisc_handle(&filter_qdisc, *argv))
invarg(*argv, "qdisc"); invarg(*argv, "qdisc");
} else if (obj != OBJ_qdisc && } else
(arg == ARG_root if (obj != OBJ_qdisc
&& (arg == ARG_root
|| arg == ARG_parent || arg == ARG_parent
|| (obj == OBJ_filter && arg >= ARG_pref))) { || (obj == OBJ_filter && arg >= ARG_pref)
)
) {
/* nothing */
} else { } else {
invarg(*argv, "command"); invarg(*argv, "command");
} }

View File

@ -129,9 +129,10 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
continue; continue;
/* NB: OPT_INVERT is always 0 or 1 */ /* NB: OPT_INVERT is always 0 or 1 */
if (!argv[0] || if (!argv[0]
(regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ || (regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
&& (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))
) ^ OPT_INVERT
) { ) {
matched_pid = proc->pid; matched_pid = proc->pid;
if (OPT_LAST) { if (OPT_LAST) {

View File

@ -950,8 +950,12 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
*buf++ = '\\'; *buf++ = '\\';
*buf++ = '\\'; *buf++ = '\\';
} }
} else if (*src == '*' || *src == '?' || *src == '[' || } else
*src == ']') *buf++ = '\\'; if (*src == '*' || *src == '?'
|| *src == '[' || *src == ']'
) {
*buf++ = '\\';
}
*buf++ = *src; *buf++ = *src;
} else if (isspace(*src)) { } else if (isspace(*src)) {
if (*prog->argv[argc_l] || (flag & LASH_OPT_SAW_QUOTE)) { if (*prog->argv[argc_l] || (flag & LASH_OPT_SAW_QUOTE)) {
@ -1365,8 +1369,9 @@ static int busy_loop(FILE *input)
continue; continue;
} }
if (!parse_command(&next_command, &newjob, &inbg) && if (!parse_command(&next_command, &newjob, &inbg)
newjob.num_progs) { && newjob.num_progs
) {
int pipefds[2] = { -1, -1 }; int pipefds[2] = { -1, -1 };
debug_printf("job=%p fed to run_command by busy_loop()'\n", debug_printf("job=%p fed to run_command by busy_loop()'\n",
&newjob); &newjob);

View File

@ -3873,9 +3873,10 @@ static char *blank(int f)
scanequals = 0; scanequals = 0;
for (;;) { for (;;) {
c = subgetc('"', foundequals); c = subgetc('"', foundequals);
if (c == 0 || if (c == 0
f & (DOBLANK && any(c, ifs->value)) || || f & (DOBLANK && any(c, ifs->value))
(!INSUB() && any(c, "\"'"))) { || (!INSUB() && any(c, "\"'"))
) {
scanequals = 0; scanequals = 0;
unget(c); unget(c);
if (any(c, "\"'")) if (any(c, "\"'"))

View File

@ -898,8 +898,12 @@ static void check_zones(unsigned i)
if (inode_count[i] > 1) /* have we counted this file already? */ if (inode_count[i] > 1) /* have we counted this file already? */
return; return;
inode = Inode1 + i; inode = Inode1 + i;
if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && if (!S_ISDIR(inode->i_mode)
!S_ISLNK(inode->i_mode)) return; && !S_ISREG(inode->i_mode)
&& !S_ISLNK(inode->i_mode)
) {
return;
}
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
add_zone(i + inode->i_zone, &changed); add_zone(i + inode->i_zone, &changed);
add_zone_ind(7 + inode->i_zone, &changed); add_zone_ind(7 + inode->i_zone, &changed);

View File

@ -907,10 +907,12 @@ get_mountport(struct pmap *pm_mnt,
goto next; goto next;
if (version && version <= 2 && pmap->pml_map.pm_vers > 2) if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
goto next; goto next;
if (pmap->pml_map.pm_vers > MAX_NFSPROT || if (pmap->pml_map.pm_vers > MAX_NFSPROT
(proto && pm_mnt->pm_prot && pmap->pml_map.pm_prot != proto) || || (proto && pm_mnt->pm_prot && pmap->pml_map.pm_prot != proto)
(port && pmap->pml_map.pm_port != port)) || (port && pmap->pml_map.pm_port != port)
) {
goto next; goto next;
}
memcpy(pm_mnt, &pmap->pml_map, sizeof(*pm_mnt)); memcpy(pm_mnt, &pmap->pml_map, sizeof(*pm_mnt));
next: next:
pmap = pmap->pml_next; pmap = pmap->pml_next;

View File

@ -176,9 +176,11 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
/* ignore any LEADING (before a '[tT]' symbol is found) /* ignore any LEADING (before a '[tT]' symbol is found)
Absolute symbols */ Absolute symbols */
if ((*mode == 'A' || *mode == '?') && total == 0) continue; if ((*mode == 'A' || *mode == '?') && total == 0) continue;
if (*mode != 'T' && *mode != 't' && if (*mode != 'T' && *mode != 't'
*mode != 'W' && *mode != 'w') && *mode != 'W' && *mode != 'w'
) {
break; /* only text is profiled */ break; /* only text is profiled */
}
if (indx >= len / sizeof(*buf)) if (indx >= len / sizeof(*buf))
bb_error_msg_and_die("profile address out of range. " bb_error_msg_and_die("profile address out of range. "

View File

@ -173,18 +173,22 @@ int FAST_FUNC volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partitio
*/ */
/* boot jump address check */ /* boot jump address check */
if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90)
vs->boot_jump[0] != 0xe9) && vs->boot_jump[0] != 0xe9
) {
return -1; return -1;
}
/* heads check */ /* heads check */
if (vs->heads == 0) if (vs->heads == 0)
return -1; return -1;
/* cluster size check */ /* cluster size check */
if (vs->sectors_per_cluster == 0 || if (vs->sectors_per_cluster == 0
(vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) || (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))
) {
return -1; return -1;
}
/* media check */ /* media check */
if (vs->media < 0xf8 && vs->media != 0xf0) if (vs->media < 0xf8 && vs->media != 0xf0)
@ -197,9 +201,11 @@ int FAST_FUNC volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partitio
valid: valid:
/* sector size check */ /* sector size check */
sector_size_bytes = le16_to_cpu(vs->sector_size_bytes); sector_size_bytes = le16_to_cpu(vs->sector_size_bytes);
if (sector_size_bytes != 0x200 && sector_size_bytes != 0x400 && if (sector_size_bytes != 0x200 && sector_size_bytes != 0x400
sector_size_bytes != 0x800 && sector_size_bytes != 0x1000) && sector_size_bytes != 0x800 && sector_size_bytes != 0x1000
) {
return -1; return -1;
}
dbg("sector_size_bytes 0x%x", sector_size_bytes); dbg("sector_size_bytes 0x%x", sector_size_bytes);
dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster);

View File

@ -73,9 +73,11 @@ int FAST_FUNC volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t of
/* check flags on all entries for a valid partition table */ /* check flags on all entries for a valid partition table */
part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET];
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (part[i].boot_ind != 0 && if (part[i].boot_ind != 0
part[i].boot_ind != 0x80) && part[i].boot_ind != 0x80
) {
return -1; return -1;
}
if (part[i].nr_sects != 0) if (part[i].nr_sects != 0)
empty = 0; empty = 0;