diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-08-13 00:18:44 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-08-13 00:18:44 +0200 |
commit | 853ccc433c4d45c3e1da4336f87b458ed10311ca (patch) | |
tree | 383ab125c708528adc2b3eef110915552189f984 /extras/volume_id | |
parent | d2e8d41b9c7bacd8169c4cb1d15b7bc95445d34b (diff) |
fix more compiler warnings ...
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'extras/volume_id')
-rw-r--r-- | extras/volume_id/volume_id/util.c | 8 | ||||
-rw-r--r-- | extras/volume_id/volume_id/volume_id.c | 2 |
2 files changed, 2 insertions, 8 deletions
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); |