diff options
author | Bas van Schaik <bas@traiectum.net> | 2015-12-03 13:28:32 +0000 |
---|---|---|
committer | Bas van Schaik <bas@traiectum.net> | 2015-12-03 13:48:46 +0000 |
commit | fa9aca493007616cdc0529a2a4d13ff397a07558 (patch) | |
tree | 8bee5b1c88f636e8d2d7ff13155cca99383b3421 /Incremental.c | |
parent | a90ed30e743c37eb53c3c0ad003e4e09abf78aac (diff) | |
download | mdadm-fa9aca493007616cdc0529a2a4d13ff397a07558.tar.gz |
avoid confusion with parameter 'devname' with same name, ensure buffer is large enough for two ints plus extras
Diffstat (limited to 'Incremental.c')
-rw-r--r-- | Incremental.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Incremental.c b/Incremental.c index 32090d9..a91129e 100644 --- a/Incremental.c +++ b/Incremental.c @@ -1030,12 +1030,12 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol, int mdfd = open_dev(chosen->sys_name); if (mdfd >= 0) { struct mddev_dev devlist; - char devname[20]; + char chosen_devname[24]; // 2*11 for int (including signs) + colon + null devlist.next = NULL; devlist.used = 0; devlist.writemostly = 0; - devlist.devname = devname; - sprintf(devname, "%d:%d", major(stb.st_rdev), + devlist.devname = chosen_devname; + sprintf(chosen_devname, "%d:%d", major(stb.st_rdev), minor(stb.st_rdev)); devlist.disposition = 'a'; close(dfd); |