aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-07-30 21:13:44 -0400
committerTheodore Ts'o <tytso@mit.edu>2019-07-30 21:13:44 -0400
commit7525e8bc125702baf480717fe67e111e5ebb63cc (patch)
tree01cf5ea858bee273f40d7d9bb80f54c5a899a294
parentcfb073a4d4f37768b0be81660054044162dd8766 (diff)
downloade2fsprogs-7525e8bc125702baf480717fe67e111e5ebb63cc.tar.gz
libblkid: fix gcc -Wall warnings
Google-Bug-Id: 118836063 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/blkid/devname.c4
-rw-r--r--lib/blkid/probe.c16
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index e2b805174..6a21963c3 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -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)
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 2e92344bd..d72014489 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -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);
}