Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/multipath/g_multipath.c
Show First 20 Lines • Show All 892 Lines • ▼ Show 20 Lines | g_multipath_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) | ||||
* If gp is *not* NULL, just use the geom's name as we're attaching | * If gp is *not* NULL, just use the geom's name as we're attaching | ||||
* this disk to the (previously generated) name. | * this disk to the (previously generated) name. | ||||
*/ | */ | ||||
if (gp1) { | if (gp1) { | ||||
sc = gp1->softc; | sc = gp1->softc; | ||||
if (gp == NULL) { | if (gp == NULL) { | ||||
char buf[16]; | char buf[16]; | ||||
u_long rand = random(); | u_long rand = arc4random(); | ||||
pfg: This one is wrong: random returns a u_long, while arc4random(9 returns uint32. | |||||
snprintf(buf, sizeof (buf), "%s-%lu", md.md_name, rand); | snprintf(buf, sizeof (buf), "%s-%lu", md.md_name, rand); | ||||
printf("GEOM_MULTIPATH: geom %s/%s exists already\n", | printf("GEOM_MULTIPATH: geom %s/%s exists already\n", | ||||
sc->sc_name, sc->sc_uuid); | sc->sc_name, sc->sc_uuid); | ||||
printf("GEOM_MULTIPATH: %s will be (temporarily) %s\n", | printf("GEOM_MULTIPATH: %s will be (temporarily) %s\n", | ||||
md.md_uuid, buf); | md.md_uuid, buf); | ||||
strlcpy(md.md_name, buf, sizeof(md.md_name)); | strlcpy(md.md_name, buf, sizeof(md.md_name)); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 651 Lines • Show Last 20 Lines |
This one is wrong: random returns a u_long, while arc4random(9 returns uint32.