summaryrefslogtreecommitdiffstats
path: root/src/inspect_fs_unix.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-12 16:27:10 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-12 16:27:10 +0000
commitd66dd2260c724bdfe57a8595aac37c8e9173cee5 (patch)
treeba15c128b3acede41361125aaa0c569bbbc870d3 /src/inspect_fs_unix.c
parent17182af3a6de8e3e94e0a914416c54f09bb74007 (diff)
downloadlibguestfs-d66dd2260c724bdfe57a8595aac37c8e9173cee5.tar.gz
libguestfs-d66dd2260c724bdfe57a8595aac37c8e9173cee5.tar.xz
libguestfs-d66dd2260c724bdfe57a8595aac37c8e9173cee5.zip
Fix strict-overflow bugs and reenable this warning.
In two places, we were counting things in an array using an 'int'. In theory, the int could overflow, so gcc determines this to be undefined behaviour. The fix is to use size_t or ssize_t instead.
Diffstat (limited to 'src/inspect_fs_unix.c')
-rw-r--r--src/inspect_fs_unix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c
index 74f014c6..e9c7d008 100644
--- a/src/inspect_fs_unix.c
+++ b/src/inspect_fs_unix.c
@@ -170,7 +170,7 @@ static size_t mdadm_app_hash(const void *x, size_t table_size);
static bool mdadm_app_cmp(const void *x, const void *y);
static void mdadm_app_free(void *x);
-static int map_app_md_devices (guestfs_h *g, Hash_table **map);
+static ssize_t map_app_md_devices (guestfs_h *g, Hash_table **map);
static int map_md_devices(guestfs_h *g, Hash_table **map);
/* Set fs->product_name to the first line of the release file. */
@@ -963,11 +963,11 @@ parse_uuid (const char *str, uint32_t *uuid)
}
/* Create a mapping of uuids to appliance md device names */
-static int
+static ssize_t
map_app_md_devices (guestfs_h *g, Hash_table **map)
{
char **mds = NULL;
- int n = 0;
+ ssize_t n = 0;
/* A hash mapping uuids to md device names */
*map = hash_initialize(16, NULL, uuid_hash, uuid_cmp, md_uuid_free);