summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2010-10-09 20:20:27 +0000
committerae <ae@FreeBSD.org>2010-10-09 20:20:27 +0000
commitab9dd3ef5837b16243ea56cca50dce6f2709cb92 (patch)
tree724bc9f6b5d1845293adad1d0f93b93234459cf7 /sbin/geom
parent0061fd332ca7c71fd44b7390a2eb33e53f4539ce (diff)
downloadFreeBSD-src-ab9dd3ef5837b16243ea56cca50dce6f2709cb92.zip
FreeBSD-src-ab9dd3ef5837b16243ea56cca50dce6f2709cb92.tar.gz
Replace strlen(_PATH_DEV) with sizeof(_PATH_DEV) - 1.
Suggested by: kib Approved by: kib (mentor) MFC after: 5 days
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/class/concat/geom_concat.c4
-rw-r--r--sbin/geom/class/eli/geom_eli.c4
-rw-r--r--sbin/geom/class/journal/geom_journal.c4
-rw-r--r--sbin/geom/class/mirror/geom_mirror.c4
-rw-r--r--sbin/geom/class/part/geom_part.c4
-rw-r--r--sbin/geom/class/raid3/geom_raid3.c4
-rw-r--r--sbin/geom/class/shsec/geom_shsec.c4
-rw-r--r--sbin/geom/class/stripe/geom_stripe.c4
-rw-r--r--sbin/geom/class/virstor/geom_virstor.c10
9 files changed, 21 insertions, 21 deletions
diff --git a/sbin/geom/class/concat/geom_concat.c b/sbin/geom/class/concat/geom_concat.c
index 80fe26b..d4f3645 100644
--- a/sbin/geom/class/concat/geom_concat.c
+++ b/sbin/geom/class/concat/geom_concat.c
@@ -153,8 +153,8 @@ concat_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ name += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, name, sizeof(md.md_provider));
}
md.md_provsize = g_get_mediasize(name);
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c
index d709721..f7953d7 100644
--- a/sbin/geom/class/eli/geom_eli.c
+++ b/sbin/geom/class/eli/geom_eli.c
@@ -776,8 +776,8 @@ eli_init(struct gctl_req *req)
const char *p = prov;
unsigned int i;
- if (strncmp(p, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- p += strlen(_PATH_DEV);
+ if (strncmp(p, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ p += sizeof(_PATH_DEV) - 1;
snprintf(backfile, sizeof(backfile), "%s%s.eli",
GELI_BACKUP_DIR, p);
/* Replace all / with _. */
diff --git a/sbin/geom/class/journal/geom_journal.c b/sbin/geom/class/journal/geom_journal.c
index b887fab..681ff47 100644
--- a/sbin/geom/class/journal/geom_journal.c
+++ b/sbin/geom/class/journal/geom_journal.c
@@ -269,8 +269,8 @@ journal_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(str, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- str += strlen(_PATH_DEV);
+ if (strncmp(str, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ str += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, str, sizeof(md.md_provider));
}
journal_metadata_encode(&md, sector);
diff --git a/sbin/geom/class/mirror/geom_mirror.c b/sbin/geom/class/mirror/geom_mirror.c
index 2cb52a9..9f0acc6 100644
--- a/sbin/geom/class/mirror/geom_mirror.c
+++ b/sbin/geom/class/mirror/geom_mirror.c
@@ -247,8 +247,8 @@ mirror_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(str, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- str += strlen(_PATH_DEV);
+ if (strncmp(str, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ str += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, str, sizeof(md.md_provider));
}
mirror_metadata_encode(&md, sector);
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index 426e1d6..55db274 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -187,8 +187,8 @@ find_geom(struct gclass *classp, const char *name)
{
struct ggeom *gp;
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ name += sizeof(_PATH_DEV) - 1;
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
if (strcmp(gp->lg_name, name) == 0)
return (gp);
diff --git a/sbin/geom/class/raid3/geom_raid3.c b/sbin/geom/class/raid3/geom_raid3.c
index 220fb09..7afc71e 100644
--- a/sbin/geom/class/raid3/geom_raid3.c
+++ b/sbin/geom/class/raid3/geom_raid3.c
@@ -244,8 +244,8 @@ raid3_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(str, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- str += strlen(_PATH_DEV);
+ if (strncmp(str, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ str += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, str, sizeof(md.md_provider));
}
if (verify && md.md_no == md.md_all - 1) {
diff --git a/sbin/geom/class/shsec/geom_shsec.c b/sbin/geom/class/shsec/geom_shsec.c
index 75791de..a5d1b66 100644
--- a/sbin/geom/class/shsec/geom_shsec.c
+++ b/sbin/geom/class/shsec/geom_shsec.c
@@ -172,8 +172,8 @@ shsec_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ name += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, name, sizeof(md.md_provider));
}
shsec_metadata_encode(&md, sector);
diff --git a/sbin/geom/class/stripe/geom_stripe.c b/sbin/geom/class/stripe/geom_stripe.c
index 215dae0..2e9e3db 100644
--- a/sbin/geom/class/stripe/geom_stripe.c
+++ b/sbin/geom/class/stripe/geom_stripe.c
@@ -197,8 +197,8 @@ stripe_label(struct gctl_req *req)
if (!hardcode)
bzero(md.md_provider, sizeof(md.md_provider));
else {
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
- name += strlen(_PATH_DEV);
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ name += sizeof(_PATH_DEV) - 1;
strlcpy(md.md_provider, name, sizeof(md.md_provider));
}
stripe_metadata_encode(&md, sector);
diff --git a/sbin/geom/class/virstor/geom_virstor.c b/sbin/geom/class/virstor/geom_virstor.c
index b08a8b9..be9a467 100644
--- a/sbin/geom/class/virstor/geom_virstor.c
+++ b/sbin/geom/class/virstor/geom_virstor.c
@@ -144,7 +144,7 @@ static void
pathgen(const char *name, char *path, size_t size)
{
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) != 0)
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0)
snprintf(path, size, "%s%s", _PATH_DEV, name);
else
strlcpy(path, name, size);
@@ -375,7 +375,7 @@ virstor_label(struct gctl_req *req)
fflush(stdout);
}
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
fd = open(name, O_RDWR);
else {
sprintf(param, "%s%s", _PATH_DEV, name);
@@ -453,8 +453,8 @@ virstor_label(struct gctl_req *req)
bzero(md.provider, sizeof(md.provider));
else {
/* convert "/dev/something" to "something" */
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0) {
- strlcpy(md.provider, name + strlen(_PATH_DEV),
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) {
+ strlcpy(md.provider, name + sizeof(_PATH_DEV) - 1,
sizeof(md.provider));
} else
strlcpy(md.provider, name, sizeof(md.provider));
@@ -509,7 +509,7 @@ virstor_clear(struct gctl_req *req)
"Not fully done (can't clear metadata).");
continue;
}
- if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+ if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
fd = open(name, O_RDWR);
else {
sprintf(param, "%s%s", _PATH_DEV, name);
OpenPOWER on IntegriCloud