]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libblkid: fix gcc -Wall warnings
authorTheodore Ts'o <tytso@mit.edu>
Wed, 31 Jul 2019 01:13:44 +0000 (21:13 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 31 Jul 2019 01:13:44 +0000 (21:13 -0400)
Google-Bug-Id: 118836063

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/blkid/devname.c
lib/blkid/probe.c

index e2b8051742c50da5c8121efb0d0fe5c9918fc04c..6a21963c373861a10ae902876f8c32980136c90f 100644 (file)
@@ -126,7 +126,7 @@ static int is_dm_leaf(const char *devname)
 {
        struct dirent   *de, *d_de;
        DIR             *dir, *d_dir;
-       char            path[256];
+       char            path[300];
        int             ret = 1;
 
        if ((dir = opendir("/sys/block")) == NULL)
@@ -162,7 +162,7 @@ static char *get_dm_name(const char *ptname)
 {
        FILE    *f;
        size_t  sz;
-       char    path[256], name[256], *res = NULL;
+       char    path[300], name[256], *res = NULL;
 
        snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);
        if ((f = fopen(path, "r")) == NULL)
index 2e92344bd1bbba02d600a4267bd91caf2bc78bf4..d72014489e2cbd8b7409acfd158d27641549c39c 100644 (file)
@@ -892,12 +892,13 @@ static int probe_luks(struct blkid_probe *probe,
                       struct blkid_magic *id __BLKID_ATTR((unused)),
                       unsigned char *buf)
 {
-       char uuid[40];
+       char uuid[41];
 
        /* 168 is the offset to the 40 character uuid:
         * http://luks.endorphin.org/LUKS-on-disk-format.pdf */
        strncpy(uuid, (char *) buf+168, 40);
-       blkid_set_tag(probe->dev, "UUID", uuid, sizeof(uuid));
+       uuid[40] = 0;
+       blkid_set_tag(probe->dev, "UUID", uuid, 40);
        return 0;
 }
 
@@ -1503,24 +1504,25 @@ static struct exfat_entry_label *find_exfat_entry_label(
     return NULL;
 }
 
-static int probe_exfat(struct blkid_probe *probe, struct blkid_magic *id,
+static int probe_exfat(struct blkid_probe *probe,
+                      struct blkid_magic *id __BLKID_ATTR((unused)),
                        unsigned char *buf)
 {
     struct exfat_super_block *sb;
     struct exfat_entry_label *label;
-    uuid_t uuid;
+    char uuid[40];
 
     sb = (struct exfat_super_block *)buf;
-    if (!sb || !CLUSTER_SIZE(sb)) {
+    if (!sb || CLUSTER_SIZE(sb) == 0) {
         DBG(DEBUG_PROBE, printf("bad exfat superblock.\n"));
         return errno ? - errno : 1;
     }
 
     label = find_exfat_entry_label(probe, sb);
     if (label) {
-        char utf8_label[128];
+        unsigned char utf8_label[128];
         unicode_16le_to_utf8(utf8_label, sizeof(utf8_label), label->name, label->length * 2);
-        blkid_set_tag(probe->dev, "LABEL", utf8_label, 0);
+        blkid_set_tag(probe->dev, "LABEL", (char *) utf8_label, 0);
     } else {
         blkid_set_tag(probe->dev, "LABEL", "disk", 4);
     }