From 853ccc433c4d45c3e1da4336f87b458ed10311ca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 Aug 2005 00:18:44 +0200 Subject: fix more compiler warnings ... Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/util.c | 8 +------- extras/volume_id/volume_id/volume_id.c | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'extras/volume_id') diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index a145a8aa2f..868d67306c 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -114,12 +114,6 @@ void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t co id->label_raw_len = count; } -static size_t my_strnlen(const char *s, size_t max) { - const char *p = s; - for (; *p && max--; ++p); - return(p - s); -} - void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { unsigned int i; @@ -127,7 +121,7 @@ void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t memcpy(id->label, buf, count); /* remove trailing whitespace */ - i = my_strnlen(id->label, count); + i = strnlen(id->label, count); while (i--) { if (!isspace(id->label[i])) break; diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 4c4a42a00d..e7d4d75666 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -227,7 +227,7 @@ struct volume_id *volume_id_open_dev_t(dev_t devt) snprintf(tmp_node, VOLUME_ID_PATH_MAX, "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); - tmp_node[VOLUME_ID_PATH_MAX] = '\0'; + tmp_node[VOLUME_ID_PATH_MAX-1] = '\0'; /* create tempory node to open the block device */ unlink(tmp_node); -- cgit v1.2.3-54-g00ecf