summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko2008-05-13 02:27:31 +0000
committerDenis Vlasenko2008-05-13 02:27:31 +0000
commit77ad97f199f1bf05e9a7609bbdd239dab825b258 (patch)
treecf117ebf8d4a50bc7ba0e4da4d60a98a944756c8 /util-linux
parentc4f12f59cc907577d787f816b37122809f896bb2 (diff)
downloadbusybox-77ad97f199f1bf05e9a7609bbdd239dab825b258.zip
busybox-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.gz
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
Diffstat (limited to 'util-linux')
-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
5 files changed, 23 insertions, 21 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 4fff20d..14aa593 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -120,8 +120,11 @@ static void make_device(char *path, int delete)
/* If not this device, skip rest of line */
/* (regexec returns whole pattern as "range" 0) */
- if (result || off[0].rm_so || off[0].rm_eo != strlen(device_name))
+ if (result || off[0].rm_so
+ || ((int)off[0].rm_eo != (int)strlen(device_name))
+ ) {
goto next_line;
+ }
}
/* This line matches: stop parsing the file
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4b8aea8..292f877 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -307,7 +307,7 @@ static long parse_mount_options(char *options, char **unrecognized)
// Loop through options
for (;;) {
- int i;
+ size_t i;
char *comma = strchr(options, ',');
const char *option_str = mount_option_str;
@@ -1004,7 +1004,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
bb_herror_msg("%s", hostname);
goto fail;
}
- if (hp->h_length > sizeof(struct in_addr)) {
+ if ((size_t)hp->h_length > sizeof(struct in_addr)) {
bb_error_msg("got bad hp->h_length");
hp->h_length = sizeof(struct in_addr);
}
@@ -1279,15 +1279,14 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
if (hp == NULL) {
bb_herror_msg("%s", mounthost);
goto fail;
- } else {
- if (hp->h_length > sizeof(struct in_addr)) {
- bb_error_msg("got bad hp->h_length?");
- hp->h_length = sizeof(struct in_addr);
- }
- mount_server_addr.sin_family = AF_INET;
- memcpy(&mount_server_addr.sin_addr,
- hp->h_addr, hp->h_length);
}
+ if ((size_t)hp->h_length > sizeof(struct in_addr)) {
+ bb_error_msg("got bad hp->h_length");
+ hp->h_length = sizeof(struct in_addr);
+ }
+ mount_server_addr.sin_family = AF_INET;
+ memcpy(&mount_server_addr.sin_addr,
+ hp->h_addr, hp->h_length);
}
}
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index c030b99..bae695b 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -13,15 +13,15 @@
// Make up for header deficiencies.
#ifndef RAMFS_MAGIC
-#define RAMFS_MAGIC 0x858458f6
+#define RAMFS_MAGIC ((unsigned)0x858458f6)
#endif
#ifndef TMPFS_MAGIC
-#define TMPFS_MAGIC 0x01021994
+#define TMPFS_MAGIC ((unsigned)0x01021994)
#endif
#ifndef MS_MOVE
-#define MS_MOVE 8192
+#define MS_MOVE 8192
#endif
static dev_t rootdev;
@@ -91,10 +91,10 @@ int switch_root_main(int argc ATTRIBUTE_UNUSED, char **argv)
// we mean it. (I could make this a CONFIG option, but I would get email
// from all the people who WILL eat their filesystems.)
- if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) ||
- (stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) ||
- getpid() != 1)
- {
+ if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs)
+ || (((unsigned)stfs.f_type != RAMFS_MAGIC) && ((unsigned)stfs.f_type != TMPFS_MAGIC))
+ || (getpid() != 1)
+ ) {
bb_error_msg_and_die("not rootfs");
}
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c
index ce7de23..240b3c1 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)
}
dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
id->sbbuf_len = buf_len;
- if (buf_len < off + len) {
+ if ((uint64_t)buf_len < off + len) {
dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
return NULL;
}
@@ -243,7 +243,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
id->seekbuf_off = off;
id->seekbuf_len = buf_len;
- if (buf_len < len) {
+ if ((size_t)buf_len < len) {
dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
return NULL;
}
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index de9aae2..aec96a2 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[] = {
int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
{
- int i;
+ size_t i;
if (id == NULL)
return -EINVAL;