aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/libunarchive/archive_xread_all_eof.c2
-rw-r--r--archival/libunarchive/decompress_bunzip2.c8
-rw-r--r--archival/libunarchive/decompress_unlzma.c6
-rw-r--r--archival/libunarchive/decompress_unzip.c6
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/appletlib.c2
-rw-r--r--libbb/lineedit.c5
-rw-r--r--libbb/u_signal_names.c8
-rw-r--r--libbb/udp_io.c2
-rw-r--r--loginutils/getty.c2
-rw-r--r--miscutils/crond.c2
-rw-r--r--miscutils/hdparm.c3
-rw-r--r--miscutils/less.c24
-rw-r--r--miscutils/makedevs.c24
-rw-r--r--modutils/insmod.c15
-rw-r--r--networking/arping.c2
-rw-r--r--networking/httpd.c2
-rw-r--r--networking/ifenslave.c2
-rw-r--r--networking/ifupdown.c6
-rw-r--r--networking/inetd.c4
-rw-r--r--networking/interface.c4
-rw-r--r--networking/isrv_identd.c2
-rw-r--r--networking/libiproute/libnetlink.c8
-rw-r--r--networking/libiproute/ll_map.c2
-rw-r--r--networking/libiproute/ll_proto.c6
-rw-r--r--networking/libiproute/ll_types.c2
-rw-r--r--networking/sendmail.c4
-rw-r--r--networking/traceroute.c2
-rw-r--r--networking/udhcp/files.c4
-rw-r--r--networking/zcip.c2
-rw-r--r--procps/kill.c9
-rw-r--r--procps/pgrep.c2
-rw-r--r--procps/pidof.c2
-rw-r--r--procps/ps.c2
-rw-r--r--procps/top.c10
-rw-r--r--shell/ash.c15
-rw-r--r--sysklogd/logread.c2
-rw-r--r--sysklogd/syslogd.c2
-rw-r--r--util-linux/fdisk_sun.c4
-rw-r--r--util-linux/getopt.c6
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/volume_id/unused_ufs.c2
-rw-r--r--util-linux/volume_id/volume_id.c2
43 files changed, 113 insertions, 110 deletions
diff --git a/archival/libunarchive/archive_xread_all_eof.c b/archival/libunarchive/archive_xread_all_eof.c
index 7e082ab1d..c93dfa282 100644
--- a/archival/libunarchive/archive_xread_all_eof.c
+++ b/archival/libunarchive/archive_xread_all_eof.c
@@ -12,7 +12,7 @@ ssize_t archive_xread_all_eof(archive_handle_t *archive_handle,
12 ssize_t size; 12 ssize_t size;
13 13
14 size = full_read(archive_handle->src_fd, buf, count); 14 size = full_read(archive_handle->src_fd, buf, count);
15 if (size != 0 && size != count) { 15 if (size != 0 && size != (ssize_t)count) {
16 bb_error_msg_and_die("short read: %u of %u", 16 bb_error_msg_and_die("short read: %u of %u",
17 (unsigned)size, (unsigned)count); 17 (unsigned)size, (unsigned)count);
18 } 18 }
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index c1b12732c..f74fdf1ad 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -103,7 +103,7 @@ static unsigned get_bits(bunzip_data *bd, int bits_wanted)
103 /* If we need to get more data from the byte buffer, do so. (Loop getting 103 /* If we need to get more data from the byte buffer, do so. (Loop getting
104 one byte at a time to enforce endianness and avoid unaligned access.) */ 104 one byte at a time to enforce endianness and avoid unaligned access.) */
105 105
106 while (bd->inbufBitCount < bits_wanted) { 106 while ((int)(bd->inbufBitCount) < bits_wanted) {
107 107
108 /* If we need to read more data from file into byte buffer, do so */ 108 /* If we need to read more data from file into byte buffer, do so */
109 109
@@ -172,7 +172,7 @@ static int get_next_block(bunzip_data *bd)
172 172
173 if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT; 173 if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT;
174 origPtr = get_bits(bd, 24); 174 origPtr = get_bits(bd, 24);
175 if (origPtr > dbufSize) return RETVAL_DATA_ERROR; 175 if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR;
176 176
177 /* mapping table: if some byte values are never used (encoding things 177 /* mapping table: if some byte values are never used (encoding things
178 like ascii text), the compression code removes the gaps to have fewer 178 like ascii text), the compression code removes the gaps to have fewer
@@ -368,7 +368,7 @@ static int get_next_block(bunzip_data *bd)
368 j = get_bits(bd, hufGroup->maxLen); 368 j = get_bits(bd, hufGroup->maxLen);
369 */ 369 */
370 370
371 while (bd->inbufBitCount < hufGroup->maxLen) { 371 while ((int)(bd->inbufBitCount) < hufGroup->maxLen) {
372 if (bd->inbufPos == bd->inbufCount) { 372 if (bd->inbufPos == bd->inbufCount) {
373 j = get_bits(bd, hufGroup->maxLen); 373 j = get_bits(bd, hufGroup->maxLen);
374 goto got_huff_bits; 374 goto got_huff_bits;
@@ -505,7 +505,7 @@ static int get_next_block(bunzip_data *bd)
505 it doesn't qualify as a run (hence writeRunCountdown=5). */ 505 it doesn't qualify as a run (hence writeRunCountdown=5). */
506 506
507 if (dbufCount) { 507 if (dbufCount) {
508 if (origPtr >= dbufCount) return RETVAL_DATA_ERROR; 508 if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR;
509 bd->writePos = dbuf[origPtr]; 509 bd->writePos = dbuf[origPtr];
510 bd->writeCurrent = (unsigned char)(bd->writePos & 0xff); 510 bd->writeCurrent = (unsigned char)(bd->writePos & 0xff);
511 bd->writePos >>= 8; 511 bd->writePos >>= 8;
diff --git a/archival/libunarchive/decompress_unlzma.c b/archival/libunarchive/decompress_unlzma.c
index 5fb7eaee0..c32040075 100644
--- a/archival/libunarchive/decompress_unlzma.c
+++ b/archival/libunarchive/decompress_unlzma.c
@@ -329,7 +329,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
329 if (buffer_pos == header.dict_size) { 329 if (buffer_pos == header.dict_size) {
330 buffer_pos = 0; 330 buffer_pos = 0;
331 global_pos += header.dict_size; 331 global_pos += header.dict_size;
332 if (full_write(dst_fd, buffer, header.dict_size) != header.dict_size) 332 if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
333 goto bad; 333 goto bad;
334 USE_DESKTOP(total_written += header.dict_size;) 334 USE_DESKTOP(total_written += header.dict_size;)
335 } 335 }
@@ -480,7 +480,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
480 if (buffer_pos == header.dict_size) { 480 if (buffer_pos == header.dict_size) {
481 buffer_pos = 0; 481 buffer_pos = 0;
482 global_pos += header.dict_size; 482 global_pos += header.dict_size;
483 if (full_write(dst_fd, buffer, header.dict_size) != header.dict_size) 483 if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
484 goto bad; 484 goto bad;
485 USE_DESKTOP(total_written += header.dict_size;) 485 USE_DESKTOP(total_written += header.dict_size;)
486 } 486 }
@@ -489,7 +489,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
489 } 489 }
490 } 490 }
491 491
492 if (full_write(dst_fd, buffer, buffer_pos) != buffer_pos) { 492 if (full_write(dst_fd, buffer, buffer_pos) != (ssize_t)buffer_pos) {
493 bad: 493 bad:
494 rc_free(rc); 494 rc_free(rc);
495 return -1; 495 return -1;
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index a764fbc98..9036fabf2 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -922,7 +922,7 @@ static int inflate_block(STATE_PARAM smallint *e)
922/* Two callsites, both in inflate_get_next_window */ 922/* Two callsites, both in inflate_get_next_window */
923static void calculate_gunzip_crc(STATE_PARAM_ONLY) 923static void calculate_gunzip_crc(STATE_PARAM_ONLY)
924{ 924{
925 int n; 925 unsigned n;
926 for (n = 0; n < gunzip_outbuf_count; n++) { 926 for (n = 0; n < gunzip_outbuf_count; n++) {
927 gunzip_crc = gunzip_crc_table[((int) gunzip_crc ^ (gunzip_window[n])) & 0xff] ^ (gunzip_crc >> 8); 927 gunzip_crc = gunzip_crc_table[((int) gunzip_crc ^ (gunzip_window[n])) & 0xff] ^ (gunzip_crc >> 8);
928 } 928 }
@@ -1003,7 +1003,7 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
1003 while (1) { 1003 while (1) {
1004 int r = inflate_get_next_window(PASS_STATE_ONLY); 1004 int r = inflate_get_next_window(PASS_STATE_ONLY);
1005 nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); 1005 nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
1006 if (nwrote != gunzip_outbuf_count) { 1006 if (nwrote != (ssize_t)gunzip_outbuf_count) {
1007 bb_perror_msg("write"); 1007 bb_perror_msg("write");
1008 n = -1; 1008 n = -1;
1009 goto ret; 1009 goto ret;
@@ -1064,7 +1064,7 @@ static int top_up(STATE_PARAM unsigned n)
1064{ 1064{
1065 int count = bytebuffer_size - bytebuffer_offset; 1065 int count = bytebuffer_size - bytebuffer_offset;
1066 1066
1067 if (count < n) { 1067 if (count < (int)n) {
1068 memmove(bytebuffer, &bytebuffer[bytebuffer_offset], count); 1068 memmove(bytebuffer, &bytebuffer[bytebuffer_offset], count);
1069 bytebuffer_offset = 0; 1069 bytebuffer_offset = 0;
1070 bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count); 1070 bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count);
diff --git a/include/libbb.h b/include/libbb.h
index 09dcc1b7f..216b3eca3 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1367,7 +1367,7 @@ extern const char bb_default_login_shell[];
1367#undef isdigit 1367#undef isdigit
1368#define isdigit(a) ((unsigned)((a) - '0') <= 9) 1368#define isdigit(a) ((unsigned)((a) - '0') <= 9)
1369 1369
1370#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 1370#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
1371 1371
1372 1372
1373#if __GNUC_PREREQ(4,1) 1373#if __GNUC_PREREQ(4,1)
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 9fe0cf963..3d5aef873 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -598,7 +598,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
598 598
599 int (*lf)(const char *, const char *); 599 int (*lf)(const char *, const char *);
600 char *fpc; 600 char *fpc;
601 int i; 601 unsigned i;
602 int rc; 602 int rc;
603 603
604 lf = link; 604 lf = link;
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 62dcc55cd..9c802a35f 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -199,7 +199,7 @@ static void cmdedit_set_out_char(int next_char)
199 { 199 {
200 bb_putchar(c); 200 bb_putchar(c);
201 } 201 }
202 if (++cmdedit_x >= cmdedit_termw) { 202 if (++cmdedit_x >= (int)cmdedit_termw) {
203 /* terminal is scrolled down */ 203 /* terminal is scrolled down */
204 cmdedit_y++; 204 cmdedit_y++;
205 cmdedit_x = 0; 205 cmdedit_x = 0;
@@ -861,7 +861,8 @@ static void input_tab(smallint *lastWasTab)
861 exe_n_cwd_tab_completion(matchBuf, find_type); 861 exe_n_cwd_tab_completion(matchBuf, find_type);
862 /* Sort, then remove any duplicates found */ 862 /* Sort, then remove any duplicates found */
863 if (matches) { 863 if (matches) {
864 int i, n = 0; 864 unsigned i;
865 int n = 0;
865 qsort_string_vector(matches, num_matches); 866 qsort_string_vector(matches, num_matches);
866 for (i = 0; i < num_matches - 1; ++i) { 867 for (i = 0; i < num_matches - 1; ++i) {
867 if (matches[i] && matches[i+1]) { /* paranoia */ 868 if (matches[i] && matches[i+1]) { /* paranoia */
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 7a0f75d6f..1dcbf5f2d 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -123,14 +123,14 @@ static const char signals[][7] = {
123 123
124int get_signum(const char *name) 124int get_signum(const char *name)
125{ 125{
126 int i; 126 unsigned i;
127 127
128 i = bb_strtou(name, NULL, 10); 128 i = bb_strtou(name, NULL, 10);
129 if (!errno) 129 if (!errno)
130 return i; 130 return i;
131 if (strncasecmp(name, "SIG", 3) == 0) 131 if (strncasecmp(name, "SIG", 3) == 0)
132 name += 3; 132 name += 3;
133 for (i = 0; (size_t)i < ARRAY_SIZE(signals); i++) 133 for (i = 0; i < ARRAY_SIZE(signals); i++)
134 if (strcasecmp(name, signals[i]) == 0) 134 if (strcasecmp(name, signals[i]) == 0)
135 return i; 135 return i;
136 136
@@ -170,9 +170,9 @@ const char *get_signame(int number)
170 170
171void print_signames(void) 171void print_signames(void)
172{ 172{
173 int signo; 173 unsigned signo;
174 174
175 for (signo = 1; (size_t)signo < ARRAY_SIZE(signals); signo++) { 175 for (signo = 1; signo < ARRAY_SIZE(signals); signo++) {
176 const char *name = signals[signo]; 176 const char *name = signals[signo];
177 if (name[0]) 177 if (name[0])
178 puts(name); 178 puts(name);
diff --git a/libbb/udp_io.c b/libbb/udp_io.c
index e968ecb66..689c39a82 100644
--- a/libbb/udp_io.c
+++ b/libbb/udp_io.c
@@ -113,7 +113,7 @@ recv_from_to(int fd, void *buf, size_t len, int flags,
113 } u; 113 } u;
114 struct cmsghdr *cmsgptr; 114 struct cmsghdr *cmsgptr;
115 struct msghdr msg; 115 struct msghdr msg;
116 socklen_t recv_length; 116 ssize_t recv_length;
117 117
118 iov[0].iov_base = buf; 118 iov[0].iov_base = buf;
119 iov[0].iov_len = len; 119 iov[0].iov_len = len;
diff --git a/loginutils/getty.c b/loginutils/getty.c
index da0dce391..5e161823a 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -479,7 +479,7 @@ static char *get_logname(char *logname, unsigned size_logname,
479 default: 479 default:
480 if (!isascii(ascval) || !isprint(ascval)) { 480 if (!isascii(ascval) || !isprint(ascval)) {
481 /* ignore garbage characters */ 481 /* ignore garbage characters */
482 } else if (bp - logname >= size_logname - 1) { 482 } else if ((int)(bp - logname) >= size_logname - 1) {
483 bb_error_msg_and_die("%s: input overrun", op->tty); 483 bb_error_msg_and_die("%s: input overrun", op->tty);
484 } else { 484 } else {
485 full_write(1, &c, 1); /* echo the character */ 485 full_write(1, &c, 1); /* echo the character */
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 0b2d55822..6db4df422 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -423,7 +423,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
423 423
424static void FixDayDow(CronLine *line) 424static void FixDayDow(CronLine *line)
425{ 425{
426 size_t i; 426 unsigned i;
427 int weekUsed = 0; 427 int weekUsed = 0;
428 int daysUsed = 0; 428 int daysUsed = 0;
429 429
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index ec5ede691..7afa9ff86 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -1486,7 +1486,8 @@ static const char xfermode_name[][5] ALIGN1 = {
1486 1486
1487static int translate_xfermode(const char *name) 1487static int translate_xfermode(const char *name)
1488{ 1488{
1489 int val, i; 1489 int val;
1490 unsigned i;
1490 1491
1491 for (i = 0; i < ARRAY_SIZE(xfermode_val); i++) { 1492 for (i = 0; i < ARRAY_SIZE(xfermode_val); i++) {
1492 if (!strncmp(name, xfermode_name[i], 5)) 1493 if (!strncmp(name, xfermode_name[i], 5))
diff --git a/miscutils/less.c b/miscutils/less.c
index 065bf6f38..25b91c0fe 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -297,7 +297,7 @@ static void read_lines(void)
297 new_linepos += 7; 297 new_linepos += 7;
298 new_linepos &= (~7); 298 new_linepos &= (~7);
299 } 299 }
300 if (new_linepos >= w) 300 if ((int)new_linepos >= w)
301 break; 301 break;
302 linepos = new_linepos; 302 linepos = new_linepos;
303 } 303 }
@@ -415,7 +415,7 @@ static void m_status_print(void)
415 printf(" lines %i-%i/%i ", 415 printf(" lines %i-%i/%i ",
416 cur_fline + 1, cur_fline + max_displayed_line + 1, 416 cur_fline + 1, cur_fline + max_displayed_line + 1,
417 max_fline + 1); 417 max_fline + 1);
418 if (cur_fline >= max_fline - max_displayed_line) { 418 if (cur_fline >= (int)(max_fline - max_displayed_line)) {
419 printf("(END)"NORMAL); 419 printf("(END)"NORMAL);
420 if (num_files > 1 && current_file != num_files) 420 if (num_files > 1 && current_file != num_files)
421 printf(HIGHLIGHT" - next: %s"NORMAL, files[current_file]); 421 printf(HIGHLIGHT" - next: %s"NORMAL, files[current_file]);
@@ -444,7 +444,7 @@ static void status_print(void)
444#endif 444#endif
445 445
446 clear_line(); 446 clear_line();
447 if (cur_fline && cur_fline < max_fline - max_displayed_line) { 447 if (cur_fline && cur_fline < (int)(max_fline - max_displayed_line)) {
448 bb_putchar(':'); 448 bb_putchar(':');
449 return; 449 return;
450 } 450 }
@@ -587,7 +587,7 @@ static void print_ascii(const char *str)
587/* Print the buffer */ 587/* Print the buffer */
588static void buffer_print(void) 588static void buffer_print(void)
589{ 589{
590 int i; 590 unsigned i;
591 591
592 move_cursor(0, 0); 592 move_cursor(0, 0);
593 for (i = 0; i <= max_displayed_line; i++) 593 for (i = 0; i <= max_displayed_line; i++)
@@ -600,7 +600,7 @@ static void buffer_print(void)
600 600
601static void buffer_fill_and_print(void) 601static void buffer_fill_and_print(void)
602{ 602{
603 int i; 603 unsigned i;
604 for (i = 0; i <= max_displayed_line && cur_fline + i <= max_fline; i++) { 604 for (i = 0; i <= max_displayed_line && cur_fline + i <= max_fline; i++) {
605 buffer[i] = flines[cur_fline + i]; 605 buffer[i] = flines[cur_fline + i];
606 } 606 }
@@ -662,7 +662,7 @@ static void open_file_and_read_lines(void)
662/* Reinitialize everything for a new file - free the memory and start over */ 662/* Reinitialize everything for a new file - free the memory and start over */
663static void reinitialize(void) 663static void reinitialize(void)
664{ 664{
665 int i; 665 unsigned i;
666 666
667 if (flines) { 667 if (flines) {
668 for (i = 0; i <= max_fline; i++) 668 for (i = 0; i <= max_fline; i++)
@@ -763,7 +763,7 @@ static int less_getch(int pos)
763static char* less_gets(int sz) 763static char* less_gets(int sz)
764{ 764{
765 char c; 765 char c;
766 int i = 0; 766 unsigned i = 0;
767 char *result = xzalloc(1); 767 char *result = xzalloc(1);
768 768
769 while (1) { 769 while (1) {
@@ -836,7 +836,7 @@ static void change_file(int direction)
836 836
837static void remove_current_file(void) 837static void remove_current_file(void)
838{ 838{
839 int i; 839 unsigned i;
840 840
841 if (num_files < 2) 841 if (num_files < 2)
842 return; 842 return;
@@ -974,7 +974,7 @@ static void regex_process(void)
974 match_pos = 0; 974 match_pos = 0;
975 fill_match_lines(0); 975 fill_match_lines(0);
976 while (match_pos < num_matches) { 976 while (match_pos < num_matches) {
977 if (match_lines[match_pos] > cur_fline) 977 if ((int)match_lines[match_pos] > cur_fline)
978 break; 978 break;
979 match_pos++; 979 match_pos++;
980 } 980 }
@@ -990,7 +990,7 @@ static void regex_process(void)
990 990
991static void number_process(int first_digit) 991static void number_process(int first_digit)
992{ 992{
993 int i; 993 unsigned i;
994 int num; 994 int num;
995 char num_input[sizeof(int)*4]; /* more than enough */ 995 char num_input[sizeof(int)*4]; /* more than enough */
996 char keypress; 996 char keypress;
@@ -1120,7 +1120,7 @@ static void save_input_to_file(void)
1120{ 1120{
1121 const char *msg = ""; 1121 const char *msg = "";
1122 char *current_line; 1122 char *current_line;
1123 int i; 1123 unsigned i;
1124 FILE *fp; 1124 FILE *fp;
1125 1125
1126 print_statusline("Log file: "); 1126 print_statusline("Log file: ");
@@ -1204,7 +1204,7 @@ static char opp_bracket(char bracket)
1204 1204
1205static void match_right_bracket(char bracket) 1205static void match_right_bracket(char bracket)
1206{ 1206{
1207 int i; 1207 unsigned i;
1208 1208
1209 if (strchr(flines[cur_fline], bracket) == NULL) { 1209 if (strchr(flines[cur_fline], bracket) == NULL) {
1210 print_statusline("No bracket in top line"); 1210 print_statusline("No bracket in top line");
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 43e4b8c4d..3b45d70b4 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -99,12 +99,12 @@ int makedevs_main(int argc, char **argv)
99 99
100 while ((line = xmalloc_fgetline(table)) != NULL) { 100 while ((line = xmalloc_fgetline(table)) != NULL) {
101 char type; 101 char type;
102 unsigned int mode = 0755; 102 unsigned mode = 0755;
103 unsigned int major = 0; 103 unsigned major = 0;
104 unsigned int minor = 0; 104 unsigned minor = 0;
105 unsigned int count = 0; 105 unsigned count = 0;
106 unsigned int increment = 0; 106 unsigned increment = 0;
107 unsigned int start = 0; 107 unsigned start = 0;
108 char name[41]; 108 char name[41];
109 char user[41]; 109 char user[41];
110 char group[41]; 110 char group[41];
@@ -121,7 +121,7 @@ int makedevs_main(int argc, char **argv)
121 { 121 {
122 if (*line=='\0' || *line=='#' || isspace(*line)) 122 if (*line=='\0' || *line=='#' || isspace(*line))
123 continue; 123 continue;
124 bb_error_msg("line %d invalid: '%s'", linenum, line); 124 bb_error_msg("invalid line %d: '%s'", linenum, line);
125 ret = EXIT_FAILURE; 125 ret = EXIT_FAILURE;
126 continue; 126 continue;
127 } 127 }
@@ -140,7 +140,7 @@ int makedevs_main(int argc, char **argv)
140 ret = EXIT_FAILURE; 140 ret = EXIT_FAILURE;
141 goto loop; 141 goto loop;
142 } 142 }
143 if ((mode != -1) && (chmod(full_name, mode) < 0)){ 143 if (chmod(full_name, mode) < 0) {
144 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name); 144 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
145 ret = EXIT_FAILURE; 145 ret = EXIT_FAILURE;
146 goto loop; 146 goto loop;
@@ -157,7 +157,7 @@ int makedevs_main(int argc, char **argv)
157 ret = EXIT_FAILURE; 157 ret = EXIT_FAILURE;
158 goto loop; 158 goto loop;
159 } 159 }
160 if ((mode != -1) && (chmod(full_name, mode) < 0)){ 160 if (chmod(full_name, mode) < 0) {
161 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name); 161 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
162 ret = EXIT_FAILURE; 162 ret = EXIT_FAILURE;
163 goto loop; 163 goto loop;
@@ -180,7 +180,7 @@ int makedevs_main(int argc, char **argv)
180 } 180 }
181 181
182 if (count > 0) { 182 if (count > 0) {
183 int i; 183 unsigned i;
184 char *full_name_inc; 184 char *full_name_inc;
185 185
186 full_name_inc = xmalloc(strlen(full_name) + 4); 186 full_name_inc = xmalloc(strlen(full_name) + 4);
@@ -195,7 +195,7 @@ int makedevs_main(int argc, char **argv)
195 bb_perror_msg("line %d: chown failed for %s", linenum, full_name_inc); 195 bb_perror_msg("line %d: chown failed for %s", linenum, full_name_inc);
196 ret = EXIT_FAILURE; 196 ret = EXIT_FAILURE;
197 } 197 }
198 if ((mode != -1) && (chmod(full_name_inc, mode) < 0)){ 198 if (chmod(full_name_inc, mode) < 0) {
199 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name_inc); 199 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name_inc);
200 ret = EXIT_FAILURE; 200 ret = EXIT_FAILURE;
201 } 201 }
@@ -211,7 +211,7 @@ int makedevs_main(int argc, char **argv)
211 bb_perror_msg("line %d: chown failed for %s", linenum, full_name); 211 bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
212 ret = EXIT_FAILURE; 212 ret = EXIT_FAILURE;
213 } 213 }
214 if ((mode != -1) && (chmod(full_name, mode) < 0)){ 214 if (chmod(full_name, mode) < 0) {
215 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name); 215 bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
216 ret = EXIT_FAILURE; 216 ret = EXIT_FAILURE;
217 } 217 }
diff --git a/modutils/insmod.c b/modutils/insmod.c
index f6dcbe8a8..0a74ba0e5 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -2041,7 +2041,7 @@ obj_add_symbol(struct obj_file *f, const char *name,
2041 int n_type = ELF_ST_TYPE(info); 2041 int n_type = ELF_ST_TYPE(info);
2042 int n_binding = ELF_ST_BIND(info); 2042 int n_binding = ELF_ST_BIND(info);
2043 2043
2044 for (sym = f->symtab[hash]; sym; sym = sym->next) 2044 for (sym = f->symtab[hash]; sym; sym = sym->next) {
2045 if (f->symbol_cmp(sym->name, name) == 0) { 2045 if (f->symbol_cmp(sym->name, name) == 0) {
2046 int o_secidx = sym->secidx; 2046 int o_secidx = sym->secidx;
2047 int o_info = sym->info; 2047 int o_info = sym->info;
@@ -2100,14 +2100,14 @@ obj_add_symbol(struct obj_file *f, const char *name,
2100 return sym; 2100 return sym;
2101 } 2101 }
2102 } 2102 }
2103 }
2103 2104
2104 /* Completely new symbol. */ 2105 /* Completely new symbol. */
2105 sym = arch_new_symbol(); 2106 sym = arch_new_symbol();
2106 sym->next = f->symtab[hash]; 2107 sym->next = f->symtab[hash];
2107 f->symtab[hash] = sym; 2108 f->symtab[hash] = sym;
2108 sym->ksymidx = -1; 2109 sym->ksymidx = -1;
2109 2110 if (ELF_ST_BIND(info) == STB_LOCAL && symidx != (unsigned long)(-1)) {
2110 if (ELF_ST_BIND(info) == STB_LOCAL && symidx != -1) {
2111 if (symidx >= f->local_symtab_size) 2111 if (symidx >= f->local_symtab_size)
2112 bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", 2112 bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld",
2113 name, (long) symidx, (long) f->local_symtab_size); 2113 name, (long) symidx, (long) f->local_symtab_size);
@@ -3313,7 +3313,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits ATTRIBUTE_UNUSED)
3313{ 3313{
3314 struct obj_file *f; 3314 struct obj_file *f;
3315 ElfW(Shdr) * section_headers; 3315 ElfW(Shdr) * section_headers;
3316 int shnum, i; 3316 size_t shnum, i;
3317 char *shstrtab; 3317 char *shstrtab;
3318 3318
3319 /* Read the file header. */ 3319 /* Read the file header. */
@@ -3585,7 +3585,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license)
3585 while (ptr < endptr) { 3585 while (ptr < endptr) {
3586 value = strchr(ptr, '='); 3586 value = strchr(ptr, '=');
3587 if (value && strncmp(ptr, "license", value-ptr) == 0) { 3587 if (value && strncmp(ptr, "license", value-ptr) == 0) {
3588 int i; 3588 unsigned i;
3589 if (license) 3589 if (license)
3590 *license = value+1; 3590 *license = value+1;
3591 for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) { 3591 for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) {
@@ -3724,7 +3724,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename,
3724 struct obj_symbol *sym; 3724 struct obj_symbol *sym;
3725 char *name, *absolute_filename; 3725 char *name, *absolute_filename;
3726 char str[STRVERSIONLEN]; 3726 char str[STRVERSIONLEN];
3727 int i, l, lm_name, lfilename, use_ksymtab, version; 3727 unsigned i;
3728 int l, lm_name, lfilename, use_ksymtab, version;
3728 struct stat statbuf; 3729 struct stat statbuf;
3729 3730
3730 /* WARNING: was using realpath, but replaced by readlink to stop using 3731 /* WARNING: was using realpath, but replaced by readlink to stop using
@@ -4127,7 +4128,7 @@ int insmod_main(int argc, char **argv)
4127 m_size = obj_load_size(f); 4128 m_size = obj_load_size(f);
4128 4129
4129 m_addr = create_module(m_name, m_size); 4130 m_addr = create_module(m_name, m_size);
4130 if (m_addr == -1) switch (errno) { 4131 if (m_addr == (ElfW(Addr))(-1)) switch (errno) {
4131 case EEXIST: 4132 case EEXIST:
4132 bb_error_msg_and_die("a module named %s already exists", m_name); 4133 bb_error_msg_and_die("a module named %s already exists", m_name);
4133 case ENOMEM: 4134 case ENOMEM:
diff --git a/networking/arping.c b/networking/arping.c
index 9d2c671bc..2db2ff412 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -174,7 +174,7 @@ static bool recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
174 if (ah->ar_pro != htons(ETH_P_IP) 174 if (ah->ar_pro != htons(ETH_P_IP)
175 || (ah->ar_pln != 4) 175 || (ah->ar_pln != 4)
176 || (ah->ar_hln != me.sll_halen) 176 || (ah->ar_hln != me.sll_halen)
177 || (len < sizeof(*ah) + 2 * (4 + ah->ar_hln))) 177 || (len < (int)(sizeof(*ah) + 2 * (4 + ah->ar_hln))))
178 return false; 178 return false;
179 179
180 memcpy(&src_ip, p + ah->ar_hln, 4); 180 memcpy(&src_ip, p + ah->ar_hln, 4);
diff --git a/networking/httpd.c b/networking/httpd.c
index 6fd322cb8..f835d80ca 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -600,7 +600,7 @@ static void parse_conf(const char *path, int flag)
600 600
601#if ENABLE_FEATURE_HTTPD_ERROR_PAGES 601#if ENABLE_FEATURE_HTTPD_ERROR_PAGES
602 if (flag == FIRST_PARSE && *p0 == 'E') { 602 if (flag == FIRST_PARSE && *p0 == 'E') {
603 int i; 603 unsigned i;
604 /* error status code */ 604 /* error status code */
605 int status = atoi(++p0); 605 int status = atoi(++p0);
606 /* c already points at the character following ':' in parse loop */ 606 /* c already points at the character following ':' in parse loop */
diff --git a/networking/ifenslave.c b/networking/ifenslave.c
index 0aa232028..983d9d096 100644
--- a/networking/ifenslave.c
+++ b/networking/ifenslave.c
@@ -604,7 +604,7 @@ static int set_if_addr(char *master_ifname, char *slave_ifname)
604 604
605 struct ifreq ifr; 605 struct ifreq ifr;
606 int res; 606 int res;
607 int i; 607 unsigned i;
608 608
609 for (i = 0; i < ARRAY_SIZE(ifra); i++) { 609 for (i = 0; i < ARRAY_SIZE(ifra); i++) {
610 strncpy_IFNAMSIZ(ifr.ifr_name, master_ifname); 610 strncpy_IFNAMSIZ(ifr.ifr_name, master_ifname);
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 50b96261b..c12391863 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -486,7 +486,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
486#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 486#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
487static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) 487static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
488{ 488{
489 int i; 489 unsigned i;
490#if ENABLE_FEATURE_IFUPDOWN_IP 490#if ENABLE_FEATURE_IFUPDOWN_IP
491 /* ip doesn't up iface when it configures it (unlike ifconfig) */ 491 /* ip doesn't up iface when it configures it (unlike ifconfig) */
492 if (!execute("ip link set %iface% up", ifd, exec)) 492 if (!execute("ip link set %iface% up", ifd, exec))
@@ -522,7 +522,7 @@ static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
522#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 522#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
523static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) 523static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
524{ 524{
525 int i; 525 unsigned i;
526 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { 526 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
527 if (exists_execable(ext_dhcp_clients[i].name)) 527 if (exists_execable(ext_dhcp_clients[i].name))
528 return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); 528 return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
@@ -1154,7 +1154,7 @@ int ifupdown_main(int argc, char **argv)
1154 char *liface; 1154 char *liface;
1155 char *pch; 1155 char *pch;
1156 bool okay = 0; 1156 bool okay = 0;
1157 unsigned cmds_ret; 1157 int cmds_ret;
1158 1158
1159 iface = xstrdup(target_list->data); 1159 iface = xstrdup(target_list->data);
1160 target_list = target_list->link; 1160 target_list = target_list->link;
diff --git a/networking/inetd.c b/networking/inetd.c
index d71a1159c..3be9dcb7f 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -750,7 +750,7 @@ static NOINLINE servtab_t *parse_one_line(void)
750 if (*p == '-') { 750 if (*p == '-') {
751 p++; 751 p++;
752 n = bb_strtou(p, &p, 10); 752 n = bb_strtou(p, &p, 10);
753 if (n > INT_MAX || n < sep->se_rpcver_lo) 753 if (n > INT_MAX || (int)n < sep->se_rpcver_lo)
754 goto bad_ver_spec; 754 goto bad_ver_spec;
755 sep->se_rpcver_hi = n; 755 sep->se_rpcver_hi = n;
756 } 756 }
@@ -812,7 +812,7 @@ static NOINLINE servtab_t *parse_one_line(void)
812 && (sep->se_socktype == SOCK_STREAM 812 && (sep->se_socktype == SOCK_STREAM
813 || sep->se_socktype == SOCK_DGRAM) 813 || sep->se_socktype == SOCK_DGRAM)
814 ) { 814 ) {
815 int i; 815 unsigned i;
816 for (i = 0; i < ARRAY_SIZE(builtins); i++) 816 for (i = 0; i < ARRAY_SIZE(builtins); i++)
817 if (strncmp(builtins[i].bi_service7, sep->se_service, 7) == 0) 817 if (strncmp(builtins[i].bi_service7, sep->se_service, 7) == 0)
818 goto found_bi; 818 goto found_bi;
diff --git a/networking/interface.c b/networking/interface.c
index ee8ab102e..a24ab01fe 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -525,7 +525,7 @@ static int if_readconf(void)
525 if (ioctl_or_warn(skfd, SIOCGIFCONF, &ifc) < 0) { 525 if (ioctl_or_warn(skfd, SIOCGIFCONF, &ifc) < 0) {
526 goto out; 526 goto out;
527 } 527 }
528 if (ifc.ifc_len == sizeof(struct ifreq) * numreqs) { 528 if (ifc.ifc_len == (int)(sizeof(struct ifreq) * numreqs)) {
529 /* assume it overflowed and try again */ 529 /* assume it overflowed and try again */
530 numreqs += 10; 530 numreqs += 10;
531 continue; 531 continue;
@@ -862,7 +862,7 @@ const struct hwtype *get_hwntype(int type)
862/* return 1 if address is all zeros */ 862/* return 1 if address is all zeros */
863static int hw_null_address(const struct hwtype *hw, void *ap) 863static int hw_null_address(const struct hwtype *hw, void *ap)
864{ 864{
865 unsigned int i; 865 int i;
866 unsigned char *address = (unsigned char *) ap; 866 unsigned char *address = (unsigned char *) ap;
867 867
868 for (i = 0; i < hw->alen; i++) 868 for (i = 0; i < hw->alen; i++)
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index a96ac6041..3e0563298 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -61,7 +61,7 @@ static int do_rd(int fd, void **paramp)
61 p = strpbrk(cur, "\r\n"); 61 p = strpbrk(cur, "\r\n");
62 if (p) 62 if (p)
63 *p = '\0'; 63 *p = '\0';
64 if (!p && sz && buf->pos <= sizeof(buf->buf)) 64 if (!p && sz && buf->pos <= (int)sizeof(buf->buf))
65 goto ok; 65 goto ok;
66 /* Terminate session. If we are in server mode, then 66 /* Terminate session. If we are in server mode, then
67 * fd is still in nonblocking mode - we never block here */ 67 * fd is still in nonblocking mode - we never block here */
diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c
index d29d035d0..47a055ac0 100644
--- a/networking/libiproute/libnetlink.c
+++ b/networking/libiproute/libnetlink.c
@@ -265,7 +265,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
265 if (msg.msg_namelen != sizeof(nladdr)) { 265 if (msg.msg_namelen != sizeof(nladdr)) {
266 bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); 266 bb_error_msg_and_die("sender address length == %d", msg.msg_namelen);
267 } 267 }
268 for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { 268 for (h = (struct nlmsghdr*)buf; status >= (int)sizeof(*h); ) {
269// int l_err; 269// int l_err;
270 int len = h->nlmsg_len; 270 int len = h->nlmsg_len;
271 int l = len - sizeof(*h); 271 int l = len - sizeof(*h);
@@ -293,7 +293,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
293 293
294 if (h->nlmsg_type == NLMSG_ERROR) { 294 if (h->nlmsg_type == NLMSG_ERROR) {
295 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); 295 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
296 if (l < sizeof(struct nlmsgerr)) { 296 if (l < (int)sizeof(struct nlmsgerr)) {
297 bb_error_msg("ERROR truncated"); 297 bb_error_msg("ERROR truncated");
298 } else { 298 } else {
299 errno = - err->error; 299 errno = - err->error;
@@ -336,7 +336,7 @@ int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data)
336{ 336{
337 int len = RTA_LENGTH(4); 337 int len = RTA_LENGTH(4);
338 struct rtattr *rta; 338 struct rtattr *rta;
339 if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) 339 if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen)
340 return -1; 340 return -1;
341 rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len)); 341 rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len));
342 rta->rta_type = type; 342 rta->rta_type = type;
@@ -351,7 +351,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
351 int len = RTA_LENGTH(alen); 351 int len = RTA_LENGTH(alen);
352 struct rtattr *rta; 352 struct rtattr *rta;
353 353
354 if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) 354 if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen)
355 return -1; 355 return -1;
356 rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len)); 356 rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len));
357 rta->rta_type = type; 357 rta->rta_type = type;
diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c
index 3cfc9ccec..031b29a60 100644
--- a/networking/libiproute/ll_map.c
+++ b/networking/libiproute/ll_map.c
@@ -75,7 +75,7 @@ int ll_remember_index(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
75 if (tb[IFLA_ADDRESS]) { 75 if (tb[IFLA_ADDRESS]) {
76 int alen; 76 int alen;
77 im->alen = alen = RTA_PAYLOAD(tb[IFLA_ADDRESS]); 77 im->alen = alen = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
78 if (alen > sizeof(im->addr)) 78 if (alen > (int)sizeof(im->addr))
79 alen = sizeof(im->addr); 79 alen = sizeof(im->addr);
80 memcpy(im->addr, RTA_DATA(tb[IFLA_ADDRESS]), alen); 80 memcpy(im->addr, RTA_DATA(tb[IFLA_ADDRESS]), alen);
81 } else { 81 } else {
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index 62262c9c2..8d9637408 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -98,10 +98,8 @@ __PF(ECONET,econet)
98 98
99const char *ll_proto_n2a(unsigned short id, char *buf, int len) 99const char *ll_proto_n2a(unsigned short id, char *buf, int len)
100{ 100{
101 int i; 101 unsigned i;
102
103 id = ntohs(id); 102 id = ntohs(id);
104
105 for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { 103 for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
106 if (llproto_names[i].id == id) 104 if (llproto_names[i].id == id)
107 return llproto_names[i].name; 105 return llproto_names[i].name;
@@ -112,7 +110,7 @@ const char *ll_proto_n2a(unsigned short id, char *buf, int len)
112 110
113int ll_proto_a2n(unsigned short *id, char *buf) 111int ll_proto_a2n(unsigned short *id, char *buf)
114{ 112{
115 int i; 113 unsigned i;
116 for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { 114 for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
117 if (strcasecmp(llproto_names[i].name, buf) == 0) { 115 if (strcasecmp(llproto_names[i].name, buf) == 0) {
118 *id = htons(llproto_names[i].id); 116 *id = htons(llproto_names[i].id);
diff --git a/networking/libiproute/ll_types.c b/networking/libiproute/ll_types.c
index 60a78c715..50c9f208f 100644
--- a/networking/libiproute/ll_types.c
+++ b/networking/libiproute/ll_types.c
@@ -187,7 +187,7 @@ const char *ll_type_n2a(int type, char *buf, int len)
187#endif /* FEATURE_IP_RARE_PROTOCOLS */ 187#endif /* FEATURE_IP_RARE_PROTOCOLS */
188 }; 188 };
189 189
190 int i; 190 unsigned i;
191 const char *aname = arphrd_name; 191 const char *aname = arphrd_name;
192 for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) { 192 for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) {
193 if (arphrd_type[i] == type) 193 if (arphrd_type[i] == type)
diff --git a/networking/sendmail.c b/networking/sendmail.c
index f37d97f73..027656dd8 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -187,7 +187,7 @@ static int smtp_checkp(const char *fmt, const char *param, int code)
187 bb_error_msg_and_die("%s failed", msg); 187 bb_error_msg_and_die("%s failed", msg);
188} 188}
189 189
190static int inline smtp_check(const char *fmt, int code) 190static inline int smtp_check(const char *fmt, int code)
191{ 191{
192 return smtp_checkp(fmt, NULL, code); 192 return smtp_checkp(fmt, NULL, code);
193} 193}
@@ -224,7 +224,7 @@ static void pop3_checkr(const char *fmt, const char *param, char **ret)
224 bb_error_msg_and_die("%s failed", msg); 224 bb_error_msg_and_die("%s failed", msg);
225} 225}
226 226
227static void inline pop3_check(const char *fmt, const char *param) 227static inline void pop3_check(const char *fmt, const char *param)
228{ 228{
229 pop3_checkr(fmt, param, NULL); 229 pop3_checkr(fmt, param, NULL);
230} 230}
diff --git a/networking/traceroute.c b/networking/traceroute.c
index c0b4a3fd2..e9df27559 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -413,7 +413,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp)
413 ifc.ifc_buf = (caddr_t)ibuf; 413 ifc.ifc_buf = (caddr_t)ibuf;
414 414
415 if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 415 if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0
416 || ifc.ifc_len < sizeof(struct ifreq) 416 || ifc.ifc_len < (int)sizeof(struct ifreq)
417 ) { 417 ) {
418 if (errno == EINVAL) 418 if (errno == EINVAL)
419 bb_error_msg_and_die( 419 bb_error_msg_and_die(
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index b13367df7..58498f9ef 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -319,7 +319,7 @@ void read_config(const char *file)
319{ 319{
320 FILE *in; 320 FILE *in;
321 char buffer[READ_CONFIG_BUF_SIZE], *token, *line; 321 char buffer[READ_CONFIG_BUF_SIZE], *token, *line;
322 int i, lineno; 322 unsigned i, lineno;
323 323
324 for (i = 0; i < KWS_WITH_DEFAULTS; i++) 324 for (i = 0; i < KWS_WITH_DEFAULTS; i++)
325 keywords[i].handler(keywords[i].def, keywords[i].var); 325 keywords[i].handler(keywords[i].def, keywords[i].var);
@@ -344,7 +344,7 @@ void read_config(const char *file)
344 for (i = 0; i < ARRAY_SIZE(keywords); i++) { 344 for (i = 0; i < ARRAY_SIZE(keywords); i++) {
345 if (!strcasecmp(token, keywords[i].keyword)) { 345 if (!strcasecmp(token, keywords[i].keyword)) {
346 if (!keywords[i].handler(line, keywords[i].var)) { 346 if (!keywords[i].handler(line, keywords[i].var)) {
347 bb_error_msg("can't parse line %d in %s at '%s'", 347 bb_error_msg("can't parse line %u in %s at '%s'",
348 lineno, file, line); 348 lineno, file, line);
349 /* reset back to the default value */ 349 /* reset back to the default value */
350 keywords[i].handler(keywords[i].def, keywords[i].var); 350 keywords[i].handler(keywords[i].def, keywords[i].var);
diff --git a/networking/zcip.c b/networking/zcip.c
index 8db840cec..fccb1a466 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -162,7 +162,7 @@ static int run(char *argv[3], struct in_addr *ip)
162/** 162/**
163 * Return milliseconds of random delay, up to "secs" seconds. 163 * Return milliseconds of random delay, up to "secs" seconds.
164 */ 164 */
165static unsigned ALWAYS_INLINE random_delay_ms(unsigned secs) 165static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs)
166{ 166{
167 return rand() % (secs * 1000); 167 return rand() % (secs * 1000);
168} 168}
diff --git a/procps/kill.c b/procps/kill.c
index b839b3819..ed659afdc 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -106,19 +106,19 @@ int kill_main(int argc, char **argv)
106 argc--; 106 argc--;
107 107
108do_it_now: 108do_it_now:
109 pid = getpid();
109 110
110 if (killall5) { 111 if (killall5) {
111 pid_t sid; 112 pid_t sid;
112 procps_status_t* p = NULL; 113 procps_status_t* p = NULL;
113 114
114 /* Now stop all processes */
115 kill(-1, SIGSTOP);
116 /* Find out our own session id */ 115 /* Find out our own session id */
117 pid = getpid();
118 sid = getsid(pid); 116 sid = getsid(pid);
117 /* Now stop all processes */
118 kill(-1, SIGSTOP);
119 /* Now kill all processes except our session */ 119 /* Now kill all processes except our session */
120 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) { 120 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) {
121 if (p->sid != sid && p->pid != pid && p->pid != 1) 121 if (p->sid != (unsigned)sid && p->pid != (unsigned)pid && p->pid != 1)
122 kill(p->pid, signo); 122 kill(p->pid, signo);
123 } 123 }
124 /* And let them continue */ 124 /* And let them continue */
@@ -134,7 +134,6 @@ do_it_now:
134 134
135 if (killall) { 135 if (killall) {
136 /* Looks like they want to do a killall. Do that */ 136 /* Looks like they want to do a killall. Do that */
137 pid = getpid();
138 while (arg) { 137 while (arg) {
139 pid_t* pidList; 138 pid_t* pidList;
140 139
diff --git a/procps/pgrep.c b/procps/pgrep.c
index f20789c81..336fa84ba 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -115,7 +115,7 @@ int pgrep_main(int argc ATTRIBUTE_UNUSED, char **argv)
115 cmd = proc->comm; 115 cmd = proc->comm;
116 /* NB: OPT_INVERT is always 0 or 1 */ 116 /* NB: OPT_INVERT is always 0 or 1 */
117 if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ 117 if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
118 && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT 118 && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT
119 ) { 119 ) {
120 matched_pid = proc->pid; 120 matched_pid = proc->pid;
121 if (OPT_LAST) { 121 if (OPT_LAST) {
diff --git a/procps/pidof.c b/procps/pidof.c
index 46e646d6e..8ed5a2155 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -59,7 +59,7 @@ int pidof_main(int argc ATTRIBUTE_UNUSED, char **argv)
59 if (opt & OPT_OMIT) { 59 if (opt & OPT_OMIT) {
60 llist_t *omits_p = omits; 60 llist_t *omits_p = omits;
61 while (omits_p) { 61 while (omits_p) {
62 if (xatoul(omits_p->data) == *pl) { 62 if (xatoul(omits_p->data) == (unsigned long)(*pl)) {
63 goto omitting; 63 goto omitting;
64 } 64 }
65 omits_p = omits_p->link; 65 omits_p = omits_p->link;
diff --git a/procps/ps.c b/procps/ps.c
index aeb8cecb4..cf939bbb8 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -310,7 +310,7 @@ static ps_out_t* new_out_t(void)
310 310
311static const ps_out_t* find_out_spec(const char *name) 311static const ps_out_t* find_out_spec(const char *name)
312{ 312{
313 int i; 313 unsigned i;
314 for (i = 0; i < ARRAY_SIZE(out_spec); i++) { 314 for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
315 if (!strcmp(name, out_spec[i].name)) 315 if (!strcmp(name, out_spec[i].name))
316 return &out_spec[i]; 316 return &out_spec[i];
diff --git a/procps/top.c b/procps/top.c
index 206f9e8be..ca43376ac 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -53,7 +53,7 @@ typedef struct jiffy_counts_t {
53 the next. Used for finding deltas. */ 53 the next. Used for finding deltas. */
54typedef struct save_hist { 54typedef struct save_hist {
55 unsigned long ticks; 55 unsigned long ticks;
56 unsigned pid; 56 pid_t pid;
57} save_hist; 57} save_hist;
58 58
59typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q); 59typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q);
@@ -317,7 +317,7 @@ static unsigned long display_header(int scr_width)
317 fclose(fp); 317 fclose(fp);
318 318
319 /* output memory info */ 319 /* output memory info */
320 if (scr_width > sizeof(scrbuf)) 320 if (scr_width > (int)sizeof(scrbuf))
321 scr_width = sizeof(scrbuf); 321 scr_width = sizeof(scrbuf);
322 snprintf(scrbuf, scr_width, 322 snprintf(scrbuf, scr_width,
323 "Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached", 323 "Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached",
@@ -481,7 +481,7 @@ static NOINLINE void display_process_list(int count, int scr_width)
481 , SHOW_STAT(pcpu) 481 , SHOW_STAT(pcpu)
482#endif 482#endif
483 ); 483 );
484 if (col + 1 < scr_width) 484 if ((int)(col + 1) < scr_width)
485 read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm); 485 read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm);
486 fputs(line_buf, stdout); 486 fputs(line_buf, stdout);
487 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu, 487 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
@@ -584,7 +584,7 @@ static char *grab_number(char *str, const char *match, unsigned sz)
584static void display_topmem_header(int scr_width) 584static void display_topmem_header(int scr_width)
585{ 585{
586 char linebuf[128]; 586 char linebuf[128];
587 int i; 587 unsigned i;
588 FILE *fp; 588 FILE *fp;
589 union { 589 union {
590 struct { 590 struct {
@@ -703,7 +703,7 @@ static NOINLINE void display_topmem_process_list(int count, int scr_width)
703 ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]); 703 ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]);
704 ulltoa6_and_space(s->stack , &line_buf[7*6]); 704 ulltoa6_and_space(s->stack , &line_buf[7*6]);
705 line_buf[8*6] = '\0'; 705 line_buf[8*6] = '\0';
706 if (scr_width > MIN_WIDTH) { 706 if (scr_width > (int)MIN_WIDTH) {
707 read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm); 707 read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm);
708 } 708 }
709 printf("\n""%.*s", scr_width, line_buf); 709 printf("\n""%.*s", scr_width, line_buf);
diff --git a/shell/ash.c b/shell/ash.c
index 200e2d4a3..e14907073 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -1790,7 +1790,7 @@ extern struct globals_var *const ash_ptr_to_globals_var;
1790#define vartab (G_var.vartab ) 1790#define vartab (G_var.vartab )
1791#define varinit (G_var.varinit ) 1791#define varinit (G_var.varinit )
1792#define INIT_G_var() do { \ 1792#define INIT_G_var() do { \
1793 int i; \ 1793 unsigned i; \
1794 (*(struct globals_var**)&ash_ptr_to_globals_var) = xzalloc(sizeof(G_var)); \ 1794 (*(struct globals_var**)&ash_ptr_to_globals_var) = xzalloc(sizeof(G_var)); \
1795 barrier(); \ 1795 barrier(); \
1796 for (i = 0; i < ARRAY_SIZE(varinit_data); i++) { \ 1796 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)
6223 if (!eq) /* stop at first non-assignment */ 6223 if (!eq) /* stop at first non-assignment */
6224 break; 6224 break;
6225 eq++; 6225 eq++;
6226 if (name_len == (eq - str) 6226 if (name_len == (unsigned)(eq - str)
6227 && strncmp(str, name, name_len) == 0) { 6227 && strncmp(str, name, name_len) == 0) {
6228 p = eq; 6228 p = eq;
6229 /* goto value; - WRONG! */ 6229 /* goto value; - WRONG! */
@@ -9500,12 +9500,13 @@ plus_minus_o(char *name, int val)
9500 ash_msg("illegal option %co %s", val ? '-' : '+', name); 9500 ash_msg("illegal option %co %s", val ? '-' : '+', name);
9501 return 1; 9501 return 1;
9502 } 9502 }
9503 for (i = 0; i < NOPTS; i++) 9503 for (i = 0; i < NOPTS; i++) {
9504 if (val) { 9504 if (val) {
9505 out1fmt("%-16s%s\n", optnames(i), optlist[i] ? "on" : "off"); 9505 out1fmt("%-16s%s\n", optnames(i), optlist[i] ? "on" : "off");
9506 } else { 9506 } else {
9507 out1fmt("set %co %s\n", optlist[i] ? '-' : '+', optnames(i)); 9507 out1fmt("set %co %s\n", optlist[i] ? '-' : '+', optnames(i));
9508 } 9508 }
9509 }
9509 return 0; 9510 return 0;
9510} 9511}
9511static void 9512static void
@@ -9699,7 +9700,7 @@ getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *opt
9699 return 1; 9700 return 1;
9700 optnext = optfirst + *param_optind - 1; 9701 optnext = optfirst + *param_optind - 1;
9701 9702
9702 if (*param_optind <= 1 || *optoff < 0 || strlen(optnext[-1]) < *optoff) 9703 if (*param_optind <= 1 || *optoff < 0 || (int)strlen(optnext[-1]) < *optoff)
9703 p = NULL; 9704 p = NULL;
9704 else 9705 else
9705 p = optnext[-1] + *optoff; 9706 p = optnext[-1] + *optoff;
@@ -11121,7 +11122,7 @@ xxreadtoken(void)
11121 return readtoken1(c, BASESYNTAX, (char *) NULL, 0); 11122 return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
11122 } 11123 }
11123 11124
11124 if (p - xxreadtoken_chars >= xxreadtoken_singles) { 11125 if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
11125 if (pgetc() == *p) { /* double occurrence? */ 11126 if (pgetc() == *p) { /* double occurrence? */
11126 p += xxreadtoken_doubles + 1; 11127 p += xxreadtoken_doubles + 1;
11127 } else { 11128 } else {
@@ -11817,7 +11818,8 @@ trapcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11817static int 11818static int
11818helpcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) 11819helpcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11819{ 11820{
11820 int col, i; 11821 unsigned col;
11822 unsigned i;
11821 11823
11822 out1fmt("\nBuilt-in commands:\n-------------------\n"); 11824 out1fmt("\nBuilt-in commands:\n-------------------\n");
11823 for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) { 11825 for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) {
@@ -12479,6 +12481,7 @@ ulimitcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
12479 12481
12480 while ((c = *p++) >= '0' && c <= '9') { 12482 while ((c = *p++) >= '0' && c <= '9') {
12481 val = (val * 10) + (long)(c - '0'); 12483 val = (val * 10) + (long)(c - '0');
12484 // val is actually 'unsigned long int' and can't get < 0
12482 if (val < (rlim_t) 0) 12485 if (val < (rlim_t) 0)
12483 break; 12486 break;
12484 } 12487 }
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 6f4429fd9..af93aab6e 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -70,7 +70,7 @@ static void interrupted(int sig ATTRIBUTE_UNUSED)
70int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 70int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
71int logread_main(int argc ATTRIBUTE_UNUSED, char **argv) 71int logread_main(int argc ATTRIBUTE_UNUSED, char **argv)
72{ 72{
73 int cur; 73 unsigned cur;
74 int log_semid; /* ipc semaphore id */ 74 int log_semid; /* ipc semaphore id */
75 int log_shmid; /* ipc shared memory id */ 75 int log_shmid; /* ipc shared memory id */
76 smallint follow = getopt32(argv, "f"); 76 smallint follow = getopt32(argv, "f");
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 371b5588f..f8fc51780 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -570,7 +570,7 @@ static void do_syslogd(void)
570 timestamp_and_log_internal("syslogd started: BusyBox v" BB_VER); 570 timestamp_and_log_internal("syslogd started: BusyBox v" BB_VER);
571 571
572 for (;;) { 572 for (;;) {
573 size_t sz; 573 ssize_t sz;
574 574
575#if ENABLE_FEATURE_SYSLOGD_DUP 575#if ENABLE_FEATURE_SYSLOGD_DUP
576 last_buf = recvbuf; 576 last_buf = recvbuf;
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c
index e595444c4..eec319c6e 100644
--- a/util-linux/fdisk_sun.c
+++ b/util-linux/fdisk_sun.c
@@ -230,8 +230,7 @@ static void
230create_sunlabel(void) 230create_sunlabel(void)
231{ 231{
232 struct hd_geometry geometry; 232 struct hd_geometry geometry;
233 unsigned int ndiv; 233 unsigned ndiv;
234 int i;
235 unsigned char c; 234 unsigned char c;
236 const struct sun_predefined_drives *p = NULL; 235 const struct sun_predefined_drives *p = NULL;
237 236
@@ -241,6 +240,7 @@ create_sunlabel(void)
241 memset(MBRbuffer, 0, sizeof(MBRbuffer)); 240 memset(MBRbuffer, 0, sizeof(MBRbuffer));
242 sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC); 241 sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC);
243 if (!floppy) { 242 if (!floppy) {
243 unsigned i;
244 puts("Drive type\n" 244 puts("Drive type\n"
245 " ? auto configure\n" 245 " ? auto configure\n"
246 " 0 custom (with hardware detected defaults)"); 246 " 0 custom (with hardware detected defaults)");
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 2da348176..31790d2a7 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -147,7 +147,7 @@ static const char *normalize(const char *arg)
147static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts) 147static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts)
148{ 148{
149 int exit_code = 0; /* We assume everything will be OK */ 149 int exit_code = 0; /* We assume everything will be OK */
150 unsigned opt; 150 int opt;
151#if ENABLE_GETOPT_LONG 151#if ENABLE_GETOPT_LONG
152 int longindex; 152 int longindex;
153#endif 153#endif
@@ -173,7 +173,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru
173#else 173#else
174 getopt(argc, argv, optstr); 174 getopt(argc, argv, optstr);
175#endif 175#endif
176 if (opt == EOF) 176 if (opt == -1)
177 break; 177 break;
178 if (opt == '?' || opt == ':' ) 178 if (opt == '?' || opt == ':' )
179 exit_code = 1; 179 exit_code = 1;
@@ -190,7 +190,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru
190 printf(" %s", normalize(optarg)); 190 printf(" %s", normalize(optarg));
191 else { 191 else {
192 printf(" -%c", opt); 192 printf(" -%c", opt);
193 charptr = strchr(optstr,opt); 193 charptr = strchr(optstr, opt);
194 if (charptr != NULL && *++charptr == ':') 194 if (charptr != NULL && *++charptr == ':')
195 printf(" %s", 195 printf(" %s",
196 normalize(optarg ? optarg : "")); 196 normalize(optarg ? optarg : ""));
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 292f877af..3cfbc5600 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -307,7 +307,7 @@ static long parse_mount_options(char *options, char **unrecognized)
307 307
308 // Loop through options 308 // Loop through options
309 for (;;) { 309 for (;;) {
310 size_t i; 310 unsigned i;
311 char *comma = strchr(options, ','); 311 char *comma = strchr(options, ',');
312 const char *option_str = mount_option_str; 312 const char *option_str = mount_option_str;
313 313
diff --git a/util-linux/volume_id/unused_ufs.c b/util-linux/volume_id/unused_ufs.c
index c666b86b8..86937585f 100644
--- a/util-linux/volume_id/unused_ufs.c
+++ b/util-linux/volume_id/unused_ufs.c
@@ -167,7 +167,7 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off)
167 static const short offsets[] = { 0, 8, 64, 256 }; 167 static const short offsets[] = { 0, 8, 64, 256 };
168 168
169 uint32_t magic; 169 uint32_t magic;
170 int i; 170 unsigned i;
171 struct ufs_super_block *ufs; 171 struct ufs_super_block *ufs;
172 172
173 dbg("probing at offset 0x%llx", (unsigned long long) off); 173 dbg("probing at offset 0x%llx", (unsigned long long) off);
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index aec96a26e..d81f3f94c 100644
--- a/util-linux/volume_id/volume_id.c
+++ b/util-linux/volume_id/volume_id.c
@@ -152,7 +152,7 @@ static const probe_fptr fs2[] = {
152 152
153int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) 153int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
154{ 154{
155 size_t i; 155 unsigned i;
156 156
157 if (id == NULL) 157 if (id == NULL)
158 return -EINVAL; 158 return -EINVAL;