aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
commit77ad97f199f1bf05e9a7609bbdd239dab825b258 (patch)
treecf117ebf8d4a50bc7ba0e4da4d60a98a944756c8
parentc4f12f59cc907577d787f816b37122809f896bb2 (diff)
downloadbusybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.gz
busybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.bz2
busybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.zip
more -Wall warning fixes from Cristian Ionescu-Idbohrn.
This time it resulted in small code changes: function old new delta nexpr 820 828 +8 tail_main 1200 1202 +2 wrapf 166 167 +1 parse_mount_options 227 209 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18) Total: -7 bytes
-rw-r--r--archival/libunarchive/get_header_tar.c4
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cut.c8
-rw-r--r--coreutils/dd.c4
-rw-r--r--coreutils/expand.c4
-rw-r--r--coreutils/sort.c3
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/tail.c9
-rw-r--r--coreutils/test.c2
-rw-r--r--coreutils/tr.c2
-rw-r--r--debianutils/start_stop_daemon.c2
-rw-r--r--editors/awk.c6
-rw-r--r--editors/sed.c6
-rw-r--r--editors/vi.c4
-rw-r--r--findutils/xargs.c2
-rw-r--r--libbb/lineedit.c8
-rw-r--r--libbb/md5.c2
-rw-r--r--libbb/read.c4
-rw-r--r--libbb/u_signal_names.c4
-rw-r--r--libbb/xfuncs_printf.c2
-rw-r--r--miscutils/crond.c4
-rw-r--r--miscutils/eject.c2
-rw-r--r--util-linux/mdev.c5
-rw-r--r--util-linux/mount.c19
-rw-r--r--util-linux/switch_root.c14
-rw-r--r--util-linux/volume_id/util.c4
-rw-r--r--util-linux/volume_id/volume_id.c2
27 files changed, 69 insertions, 61 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 29aed184c..0be29b7ce 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -138,12 +138,12 @@ char get_header_tar(archive_handle_t *archive_handle)
138 /* tar gz/bz autodetect: check for gz/bz2 magic. 138 /* tar gz/bz autodetect: check for gz/bz2 magic.
139 * If it is the very first block, and we see the magic, 139 * If it is the very first block, and we see the magic,
140 * we can switch to get_header_tar_gz/bz2/lzma(). 140 * we can switch to get_header_tar_gz/bz2/lzma().
141 * Needs seekable fd. I wish recv(MSG_PEEK) would work 141 * Needs seekable fd. I wish recv(MSG_PEEK) works
142 * on any fd... */ 142 * on any fd... */
143 if (not_first) 143 if (not_first)
144 goto err; 144 goto err;
145#if ENABLE_FEATURE_TAR_GZIP 145#if ENABLE_FEATURE_TAR_GZIP
146 if (tar.name[0] == 0x1f && tar.name[1] == 0x8b) { /* gzip */ 146 if (tar.name[0] == 0x1f && tar.name[1] == (char)0x8b) { /* gzip */
147 get_header_ptr = get_header_tar_gz; 147 get_header_ptr = get_header_tar_gz;
148 } else 148 } else
149#endif 149#endif
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 2216182e0..a3085ede3 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -48,5 +48,5 @@ int basename_main(int argc, char **argv)
48 48
49 /* puts(s) will do, but we can do without stdio this way: */ 49 /* puts(s) will do, but we can do without stdio this way: */
50 s[m++] = '\n'; 50 s[m++] = '\n';
51 return full_write(STDOUT_FILENO, s, m) == m; 51 return full_write(STDOUT_FILENO, s, m) == (ssize_t)m;
52} 52}
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 7a44d1088..1634fc8c8 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -64,7 +64,7 @@ static void cut_file(FILE *file, char delim)
64 /* print the chars specified in each cut list */ 64 /* print the chars specified in each cut list */
65 for (; cl_pos < nlists; cl_pos++) { 65 for (; cl_pos < nlists; cl_pos++) {
66 spos = cut_lists[cl_pos].startpos; 66 spos = cut_lists[cl_pos].startpos;
67 while (spos < strlen(line)) { 67 while (spos < (int)strlen(line)) {
68 if (!printed[spos]) { 68 if (!printed[spos]) {
69 printed[spos] = 'X'; 69 printed[spos] = 'X';
70 putchar(line[spos]); 70 putchar(line[spos]);
@@ -80,12 +80,12 @@ static void cut_file(FILE *file, char delim)
80 80
81 /* get out if we have no more lists to process or if the lines 81 /* get out if we have no more lists to process or if the lines
82 * are lower than what we're interested in */ 82 * are lower than what we're interested in */
83 if (linenum < spos || cl_pos >= nlists) 83 if (((int)linenum < spos) || (cl_pos >= nlists))
84 goto next_line; 84 goto next_line;
85 85
86 /* if the line we're looking for is lower than the one we were 86 /* if the line we're looking for is lower than the one we were
87 * passed, it means we displayed it already, so move on */ 87 * passed, it means we displayed it already, so move on */
88 while (spos < linenum) { 88 while (spos < (int)linenum) {
89 spos++; 89 spos++;
90 /* go to the next list if we're at the end of this one */ 90 /* go to the next list if we're at the end of this one */
91 if (spos > cut_lists[cl_pos].endpos 91 if (spos > cut_lists[cl_pos].endpos
@@ -97,7 +97,7 @@ static void cut_file(FILE *file, char delim)
97 spos = cut_lists[cl_pos].startpos; 97 spos = cut_lists[cl_pos].startpos;
98 /* get out if the current line is lower than the one 98 /* get out if the current line is lower than the one
99 * we just became interested in */ 99 * we just became interested in */
100 if (linenum < spos) 100 if ((int)linenum < spos)
101 goto next_line; 101 goto next_line;
102 } 102 }
103 } 103 }
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 4d1ef0b76..6b66366b6 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -65,7 +65,7 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
65 ssize_t n = full_write_or_warn(buf, len, filename); 65 ssize_t n = full_write_or_warn(buf, len, filename);
66 if (n < 0) 66 if (n < 0)
67 return 1; 67 return 1;
68 if (n == obs) 68 if ((size_t)n == obs)
69 G.out_full++; 69 G.out_full++;
70 else if (n) /* > 0 */ 70 else if (n) /* > 0 */
71 G.out_part++; 71 G.out_part++;
@@ -312,7 +312,7 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
312 while (n) { 312 while (n) {
313 size_t d = obs - oc; 313 size_t d = obs - oc;
314 314
315 if (d > n) 315 if (d > (size_t)n)
316 d = n; 316 d = n;
317 memcpy(obuf + oc, tmp, d); 317 memcpy(obuf + oc, tmp, d);
318 n -= d; 318 n -= d;
diff --git a/coreutils/expand.c b/coreutils/expand.c
index a7ac8ea84..af2ef8675 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -41,7 +41,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
41 char *line; 41 char *line;
42 char *ptr; 42 char *ptr;
43 int convert; 43 int convert;
44 int pos; 44 unsigned pos;
45 45
46 /* Increment tab_size by 1 locally.*/ 46 /* Increment tab_size by 1 locally.*/
47 tab_size++; 47 tab_size++;
@@ -80,7 +80,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
80 int convert; 80 int convert;
81 int pos; 81 int pos;
82 int i = 0; 82 int i = 0;
83 int column = 0; 83 unsigned column = 0;
84 84
85 while ((line = xmalloc_fgets(file)) != NULL) { 85 while ((line = xmalloc_fgets(file)) != NULL) {
86 convert = 1; 86 convert = 1;
diff --git a/coreutils/sort.c b/coreutils/sort.c
index a54be7269..12b463a6d 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -59,7 +59,8 @@ static struct sort_key {
59 59
60static char *get_key(char *str, struct sort_key *key, int flags) 60static char *get_key(char *str, struct sort_key *key, int flags)
61{ 61{
62 int start = 0, end = 0, len, i, j; 62 int start = 0, end = 0, len, j;
63 unsigned i;
63 64
64 /* Special case whole string, so we don't have to make a copy */ 65 /* Special case whole string, so we don't have to make a copy */
65 if (key->range[0] == 1 && !key->range[1] && !key->range[2] && !key->range[3] 66 if (key->range[0] == 1 && !key->range[1] && !key->range[2] && !key->range[3]
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 298fb5b70..a17955a6a 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -710,7 +710,7 @@ static void wrapf(const char *message, ...)
710{ 710{
711 char buf[128]; 711 char buf[128];
712 va_list args; 712 va_list args;
713 int buflen; 713 unsigned buflen;
714 714
715 va_start(args, message); 715 va_start(args, message);
716 buflen = vsnprintf(buf, sizeof(buf), message, args); 716 buflen = vsnprintf(buf, sizeof(buf), message, args);
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 2f997a9f6..2505fc3a6 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -92,7 +92,8 @@ int tail_main(int argc, char **argv)
92 size_t tailbufsize; 92 size_t tailbufsize;
93 int taillen = 0; 93 int taillen = 0;
94 int newlines_seen = 0; 94 int newlines_seen = 0;
95 int nfiles, nread, nwrite, seen, i, opt; 95 int nfiles, nread, nwrite, i, opt;
96 unsigned seen;
96 97
97 int *fds; 98 int *fds;
98 char *s, *buf; 99 char *s, *buf;
@@ -210,7 +211,7 @@ int tail_main(int argc, char **argv)
210 } else if (count) { 211 } else if (count) {
211 if (COUNT_BYTES) { 212 if (COUNT_BYTES) {
212 taillen += nread; 213 taillen += nread;
213 if (taillen > count) { 214 if (taillen > (int)count) {
214 memmove(tailbuf, tailbuf + taillen - count, count); 215 memmove(tailbuf, tailbuf + taillen - count, count);
215 taillen = count; 216 taillen = count;
216 } 217 }
@@ -225,7 +226,7 @@ int tail_main(int argc, char **argv)
225 } 226 }
226 } while (k); 227 } while (k);
227 228
228 if (newlines_seen + newlines_in_buf < count) { 229 if (newlines_seen + newlines_in_buf < (int)count) {
229 newlines_seen += newlines_in_buf; 230 newlines_seen += newlines_in_buf;
230 taillen += nread; 231 taillen += nread;
231 } else { 232 } else {
@@ -243,7 +244,7 @@ int tail_main(int argc, char **argv)
243 memmove(tailbuf, s, taillen); 244 memmove(tailbuf, s, taillen);
244 newlines_seen = count - extra; 245 newlines_seen = count - extra;
245 } 246 }
246 if (tailbufsize < taillen + BUFSIZ) { 247 if (tailbufsize < (size_t)taillen + BUFSIZ) {
247 tailbufsize = taillen + BUFSIZ; 248 tailbufsize = taillen + BUFSIZ;
248 tailbuf = xrealloc(tailbuf, tailbufsize); 249 tailbuf = xrealloc(tailbuf, tailbufsize);
249 } 250 }
diff --git a/coreutils/test.c b/coreutils/test.c
index 3c725a245..270ca21a9 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -412,7 +412,7 @@ static int test_eaccess(char *path, int mode)
412static int filstat(char *nm, enum token mode) 412static int filstat(char *nm, enum token mode)
413{ 413{
414 struct stat s; 414 struct stat s;
415 int i = i; /* gcc 3.x thinks it can be used uninitialized */ 415 unsigned i = i; /* gcc 3.x thinks it can be used uninitialized */
416 416
417 if (mode == FILSYM) { 417 if (mode == FILSYM) {
418#ifdef S_IFLNK 418#ifdef S_IFLNK
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 0d3284900..8b2d30802 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -219,7 +219,7 @@ int tr_main(int argc ATTRIBUTE_UNUSED, char **argv)
219 219
220 for (;;) { 220 for (;;) {
221 /* If we're out of input, flush output and read more input. */ 221 /* If we're out of input, flush output and read more input. */
222 if (in_index == read_chars) { 222 if ((ssize_t)in_index == read_chars) {
223 if (out_index) { 223 if (out_index) {
224 xwrite(STDOUT_FILENO, (char *)output, out_index); 224 xwrite(STDOUT_FILENO, (char *)output, out_index);
225 out_index = 0; 225 out_index = 0;
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 467deed48..094b3b18a 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -126,7 +126,7 @@ static int pid_is_user(int pid)
126 sprintf(buf, "/proc/%u", pid); 126 sprintf(buf, "/proc/%u", pid);
127 if (stat(buf, &sb) != 0) 127 if (stat(buf, &sb) != 0)
128 return 0; 128 return 0;
129 return (sb.st_uid == user_id); 129 return (sb.st_uid == (uid_t)user_id);
130} 130}
131 131
132static int pid_is_cmd(pid_t pid) 132static int pid_is_cmd(pid_t pid)
diff --git a/editors/awk.c b/editors/awk.c
index f04ea5ced..fef3246b8 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -676,7 +676,7 @@ static char nextchar(char **s)
676 return c; 676 return c;
677} 677}
678 678
679static int ALWAYS_INLINE isalnum_(int c) 679static ALWAYS_INLINE int isalnum_(int c)
680{ 680{
681 return (isalnum(c) || c == '_'); 681 return (isalnum(c) || c == '_');
682} 682}
@@ -1682,7 +1682,7 @@ static void hashwalk_init(var *v, xhash *array)
1682{ 1682{
1683 char **w; 1683 char **w;
1684 hash_item *hi; 1684 hash_item *hi;
1685 int i; 1685 unsigned i;
1686 1686
1687 if (v->type & VF_WALK) 1687 if (v->type & VF_WALK)
1688 free(v->x.walker); 1688 free(v->x.walker);
@@ -1996,7 +1996,7 @@ static var *exec_builtin(node *op, var *res)
1996 } 1996 }
1997 1997
1998 nargs = i; 1998 nargs = i;
1999 if (nargs < (info >> 30)) 1999 if ((uint32_t)nargs < (info >> 30))
2000 syntax_error(EMSG_TOO_FEW_ARGS); 2000 syntax_error(EMSG_TOO_FEW_ARGS);
2001 2001
2002 switch (info & OPNMASK) { 2002 switch (info & OPNMASK) {
diff --git a/editors/sed.c b/editors/sed.c
index f85884534..817840dc0 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -628,7 +628,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line)
628{ 628{
629 char *oldline = *line; 629 char *oldline = *line;
630 int altered = 0; 630 int altered = 0;
631 int match_count = 0; 631 unsigned match_count = 0;
632 regex_t *current_regex; 632 regex_t *current_regex;
633 633
634 /* Handle empty regex. */ 634 /* Handle empty regex. */
@@ -665,7 +665,9 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line)
665 665
666 /* If we aren't interested in this match, output old line to 666 /* If we aren't interested in this match, output old line to
667 end of match and continue */ 667 end of match and continue */
668 if (sed_cmd->which_match && sed_cmd->which_match != match_count) { 668 if (sed_cmd->which_match
669 && (sed_cmd->which_match != match_count)
670 ) {
669 for (i = 0; i < G.regmatch[0].rm_eo; i++) 671 for (i = 0; i < G.regmatch[0].rm_eo; i++)
670 pipe_putc(*oldline++); 672 pipe_putc(*oldline++);
671 continue; 673 continue;
diff --git a/editors/vi.c b/editors/vi.c
index 4e5a5ac4a..5013d0d51 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2239,7 +2239,9 @@ static char readit(void) // read (maybe cursor) key from stdin
2239 pfd[0].events = POLLIN; 2239 pfd[0].events = POLLIN;
2240 // keep reading while there are input chars, and room in buffer 2240 // keep reading while there are input chars, and room in buffer
2241 // for a complete ESC sequence (assuming 8 chars is enough) 2241 // for a complete ESC sequence (assuming 8 chars is enough)
2242 while (safe_poll(pfd, 1, 0) > 0 && n <= (sizeof(readbuffer) - 8)) { 2242 while ((safe_poll(pfd, 1, 0) > 0)
2243 && ((size_t)n <= (sizeof(readbuffer) - 8))
2244 ) {
2243 // read the rest of the ESC string 2245 // read the rest of the ESC string
2244 int r = safe_read(0, readbuffer + n, sizeof(readbuffer) - n); 2246 int r = safe_read(0, readbuffer + n, sizeof(readbuffer) - n);
2245 if (r > 0) 2247 if (r > 0)
diff --git a/findutils/xargs.c b/findutils/xargs.c
index ee16ea675..d1cf192b1 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -233,7 +233,7 @@ static xlist_t *process_stdin(xlist_t *list_arg,
233 } 233 }
234 if (s == NULL) 234 if (s == NULL)
235 s = p = buf; 235 s = p = buf;
236 if ((p - buf) >= mc) 236 if ((size_t)(p - buf) >= mc)
237 bb_error_msg_and_die("argument line too long"); 237 bb_error_msg_and_die("argument line too long");
238 *p++ = (c == EOF ? '\0' : c); 238 *p++ = (c == EOF ? '\0' : c);
239 if (c == EOF) { /* word's delimiter or EOF detected */ 239 if (c == EOF) { /* word's delimiter or EOF detected */
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d1a7a4bac..62dcc55cd 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -262,7 +262,7 @@ static void input_backward(unsigned num)
262 return; 262 return;
263 cursor -= num; 263 cursor -= num;
264 264
265 if (cmdedit_x >= num) { 265 if ((unsigned)cmdedit_x >= num) {
266 cmdedit_x -= num; 266 cmdedit_x -= num;
267 if (num <= 4) { 267 if (num <= 4) {
268 /* This is longer by 5 bytes on x86. 268 /* This is longer by 5 bytes on x86.
@@ -321,7 +321,7 @@ static void input_delete(int save)
321{ 321{
322 int j = cursor; 322 int j = cursor;
323 323
324 if (j == command_len) 324 if (j == (int)command_len)
325 return; 325 return;
326 326
327#if ENABLE_FEATURE_EDITING_VI 327#if ENABLE_FEATURE_EDITING_VI
@@ -830,7 +830,7 @@ static void input_tab(smallint *lastWasTab)
830 830
831 if (!*lastWasTab) { 831 if (!*lastWasTab) {
832 char *tmp, *tmp1; 832 char *tmp, *tmp1;
833 int len_found; 833 size_t len_found;
834/* char matchBuf[MAX_LINELEN]; */ 834/* char matchBuf[MAX_LINELEN]; */
835#define matchBuf (S.input_tab__matchBuf) 835#define matchBuf (S.input_tab__matchBuf)
836 int find_type; 836 int find_type;
@@ -1787,7 +1787,7 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t
1787 if (vi_cmdmode) /* Don't self-insert */ 1787 if (vi_cmdmode) /* Don't self-insert */
1788 break; 1788 break;
1789#endif 1789#endif
1790 if (command_len >= (maxsize - 2)) /* Need to leave space for enter */ 1790 if ((int)command_len >= (maxsize - 2)) /* Need to leave space for enter */
1791 break; 1791 break;
1792 1792
1793 command_len++; 1793 command_len++;
diff --git a/libbb/md5.c b/libbb/md5.c
index 56f97270d..8d4b9fe52 100644
--- a/libbb/md5.c
+++ b/libbb/md5.c
@@ -383,7 +383,7 @@ void md5_hash(const void *buffer, size_t len, md5_ctx_t *ctx)
383 // Process all input. 383 // Process all input.
384 384
385 while (len) { 385 while (len) {
386 int i = 64 - ctx->buflen; 386 unsigned i = 64 - ctx->buflen;
387 387
388 // Copy data into aligned buffer. 388 // Copy data into aligned buffer.
389 389
diff --git a/libbb/read.c b/libbb/read.c
index 288358d79..fb903c18a 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -111,7 +111,7 @@ void xread(int fd, void *buf, size_t count)
111{ 111{
112 if (count) { 112 if (count) {
113 ssize_t size = full_read(fd, buf, count); 113 ssize_t size = full_read(fd, buf, count);
114 if (size != count) 114 if ((size_t)size != count)
115 bb_error_msg_and_die("short read"); 115 bb_error_msg_and_die("short read");
116 } 116 }
117} 117}
@@ -160,7 +160,7 @@ char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
160 160
161 goto jump_in; 161 goto jump_in;
162 while (sz < maxsz) { 162 while (sz < maxsz) {
163 if (p - buf == sz) { 163 if ((size_t)(p - buf) == sz) {
164 jump_in: 164 jump_in:
165 buf = xrealloc(buf, sz + 128); 165 buf = xrealloc(buf, sz + 128);
166 p = buf + sz; 166 p = buf + sz;
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 97e9949e9..7a0f75d6f 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -130,7 +130,7 @@ int get_signum(const char *name)
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; i < ARRAY_SIZE(signals); i++) 133 for (i = 0; (size_t)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
@@ -172,7 +172,7 @@ void print_signames(void)
172{ 172{
173 int signo; 173 int signo;
174 174
175 for (signo = 1; signo < ARRAY_SIZE(signals); signo++) { 175 for (signo = 1; (size_t)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/xfuncs_printf.c b/libbb/xfuncs_printf.c
index d3fb39f04..105939b5e 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -204,7 +204,7 @@ void xwrite(int fd, const void *buf, size_t count)
204{ 204{
205 if (count) { 205 if (count) {
206 ssize_t size = full_write(fd, buf, count); 206 ssize_t size = full_write(fd, buf, count);
207 if (size != count) 207 if ((size_t)size != count)
208 bb_error_msg_and_die("short write"); 208 bb_error_msg_and_die("short write");
209 } 209 }
210} 210}
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 98dd22d9d..0b2d55822 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -145,7 +145,7 @@ static void crondlog(const char *ctl, ...)
145 int level = (ctl[0] & 0x1f); 145 int level = (ctl[0] & 0x1f);
146 146
147 va_start(va, ctl); 147 va_start(va, ctl);
148 if (level >= LogLevel) { 148 if (level >= (int)LogLevel) {
149 /* Debug mode: all to (non-redirected) stderr, */ 149 /* Debug mode: all to (non-redirected) stderr, */
150 /* Syslog mode: all to syslog (logmode = LOGMODE_SYSLOG), */ 150 /* Syslog mode: all to syslog (logmode = LOGMODE_SYSLOG), */
151 if (!DebugOpt && LogFile) { 151 if (!DebugOpt && LogFile) {
@@ -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 int i; 426 size_t i;
427 int weekUsed = 0; 427 int weekUsed = 0;
428 int daysUsed = 0; 428 int daysUsed = 0;
429 429
diff --git a/miscutils/eject.c b/miscutils/eject.c
index 91cf98f5f..aa22a3a42 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -38,7 +38,7 @@ static void eject_scsi(const char *dev)
38 { START_STOP, 0, 0, 0, 2, 0 } 38 { START_STOP, 0, 0, 0, 2, 0 }
39 }; 39 };
40 40
41 int i; 41 unsigned i;
42 unsigned char sense_buffer[32]; 42 unsigned char sense_buffer[32];
43 unsigned char inqBuff[2]; 43 unsigned char inqBuff[2];
44 sg_io_hdr_t io_hdr; 44 sg_io_hdr_t io_hdr;
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 4fff20dcd..14aa593f5 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -120,8 +120,11 @@ static void make_device(char *path, int delete)
120 120
121 /* If not this device, skip rest of line */ 121 /* If not this device, skip rest of line */
122 /* (regexec returns whole pattern as "range" 0) */ 122 /* (regexec returns whole pattern as "range" 0) */
123 if (result || off[0].rm_so || off[0].rm_eo != strlen(device_name)) 123 if (result || off[0].rm_so
124 || ((int)off[0].rm_eo != (int)strlen(device_name))
125 ) {
124 goto next_line; 126 goto next_line;
127 }
125 } 128 }
126 129
127 /* This line matches: stop parsing the file 130 /* This line matches: stop parsing the file
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4b8aea8c6..292f877af 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 int i; 310 size_t 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
@@ -1004,7 +1004,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1004 bb_herror_msg("%s", hostname); 1004 bb_herror_msg("%s", hostname);
1005 goto fail; 1005 goto fail;
1006 } 1006 }
1007 if (hp->h_length > sizeof(struct in_addr)) { 1007 if ((size_t)hp->h_length > sizeof(struct in_addr)) {
1008 bb_error_msg("got bad hp->h_length"); 1008 bb_error_msg("got bad hp->h_length");
1009 hp->h_length = sizeof(struct in_addr); 1009 hp->h_length = sizeof(struct in_addr);
1010 } 1010 }
@@ -1279,15 +1279,14 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1279 if (hp == NULL) { 1279 if (hp == NULL) {
1280 bb_herror_msg("%s", mounthost); 1280 bb_herror_msg("%s", mounthost);
1281 goto fail; 1281 goto fail;
1282 } else {
1283 if (hp->h_length > sizeof(struct in_addr)) {
1284 bb_error_msg("got bad hp->h_length?");
1285 hp->h_length = sizeof(struct in_addr);
1286 }
1287 mount_server_addr.sin_family = AF_INET;
1288 memcpy(&mount_server_addr.sin_addr,
1289 hp->h_addr, hp->h_length);
1290 } 1282 }
1283 if ((size_t)hp->h_length > sizeof(struct in_addr)) {
1284 bb_error_msg("got bad hp->h_length");
1285 hp->h_length = sizeof(struct in_addr);
1286 }
1287 mount_server_addr.sin_family = AF_INET;
1288 memcpy(&mount_server_addr.sin_addr,
1289 hp->h_addr, hp->h_length);
1291 } 1290 }
1292 } 1291 }
1293 1292
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index c030b99e1..bae695b0b 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -13,15 +13,15 @@
13// Make up for header deficiencies. 13// Make up for header deficiencies.
14 14
15#ifndef RAMFS_MAGIC 15#ifndef RAMFS_MAGIC
16#define RAMFS_MAGIC 0x858458f6 16#define RAMFS_MAGIC ((unsigned)0x858458f6)
17#endif 17#endif
18 18
19#ifndef TMPFS_MAGIC 19#ifndef TMPFS_MAGIC
20#define TMPFS_MAGIC 0x01021994 20#define TMPFS_MAGIC ((unsigned)0x01021994)
21#endif 21#endif
22 22
23#ifndef MS_MOVE 23#ifndef MS_MOVE
24#define MS_MOVE 8192 24#define MS_MOVE 8192
25#endif 25#endif
26 26
27static dev_t rootdev; 27static dev_t rootdev;
@@ -91,10 +91,10 @@ int switch_root_main(int argc ATTRIBUTE_UNUSED, char **argv)
91 // we mean it. (I could make this a CONFIG option, but I would get email 91 // we mean it. (I could make this a CONFIG option, but I would get email
92 // from all the people who WILL eat their filesystems.) 92 // from all the people who WILL eat their filesystems.)
93 93
94 if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) || 94 if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs)
95 (stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) || 95 || (((unsigned)stfs.f_type != RAMFS_MAGIC) && ((unsigned)stfs.f_type != TMPFS_MAGIC))
96 getpid() != 1) 96 || (getpid() != 1)
97 { 97 ) {
98 bb_error_msg_and_die("not rootfs"); 98 bb_error_msg_and_die("not rootfs");
99 } 99 }
100 100
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c
index ce7de23fb..240b3c1e3 100644
--- a/util-linux/volume_id/util.c
+++ b/util-linux/volume_id/util.c
@@ -212,7 +212,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
212 } 212 }
213 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); 213 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
214 id->sbbuf_len = buf_len; 214 id->sbbuf_len = buf_len;
215 if (buf_len < off + len) { 215 if ((uint64_t)buf_len < off + len) {
216 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); 216 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
217 return NULL; 217 return NULL;
218 } 218 }
@@ -243,7 +243,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
243 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); 243 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
244 id->seekbuf_off = off; 244 id->seekbuf_off = off;
245 id->seekbuf_len = buf_len; 245 id->seekbuf_len = buf_len;
246 if (buf_len < len) { 246 if ((size_t)buf_len < len) {
247 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); 247 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
248 return NULL; 248 return NULL;
249 } 249 }
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index de9aae2ce..aec96a26e 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 int i; 155 size_t i;
156 156
157 if (id == NULL) 157 if (id == NULL)
158 return -EINVAL; 158 return -EINVAL;