From ab9dd3ef5837b16243ea56cca50dce6f2709cb92 Mon Sep 17 00:00:00 2001 From: ae Date: Sat, 9 Oct 2010 20:20:27 +0000 Subject: Replace strlen(_PATH_DEV) with sizeof(_PATH_DEV) - 1. Suggested by: kib Approved by: kib (mentor) MFC after: 5 days --- sys/geom/part/g_part.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/geom/part') diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 9e7c9c0..eb7dcda 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -305,8 +305,8 @@ g_part_parm_geom(struct gctl_req *req, const char *name, struct g_geom **v) gname = gctl_get_asciiparam(req, name); if (gname == NULL) return (ENOATTR); - if (strncmp(gname, _PATH_DEV, strlen(_PATH_DEV)) == 0) - gname += strlen(_PATH_DEV); + if (strncmp(gname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + gname += sizeof(_PATH_DEV) - 1; LIST_FOREACH(gp, &g_part_class.geom, geom) { if (!strcmp(gname, gp->name)) break; @@ -329,8 +329,8 @@ g_part_parm_provider(struct gctl_req *req, const char *name, pname = gctl_get_asciiparam(req, name); if (pname == NULL) return (ENOATTR); - if (strncmp(pname, _PATH_DEV, strlen(_PATH_DEV)) == 0) - pname += strlen(_PATH_DEV); + if (strncmp(pname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + pname += sizeof(_PATH_DEV) - 1; pp = g_provider_by_name(pname); if (pp == NULL) { gctl_error(req, "%d %s '%s'", EINVAL, name, pname); -- cgit v1.1