We support some non-number raid levels, but if it is a number, it should
parse like a number (boo atoi). Actual checking the correct value is done
elsewhere.
Index: bioctl.c
===================================================================
RCS file: /home/tedu/cvs/src/sbin/bioctl/bioctl.c,v
retrieving revision 1.99
diff -u -r1.99 bioctl.c
--- bioctl.c 4 Apr 2011 15:22:31 -0000 1.99
+++ bioctl.c 4 Jul 2011 04:23:33 -0000
@@ -124,9 +124,11 @@
break;
case 'c': /* create */
func |= BIOC_CREATERAID;
- if (isdigit(*optarg))
- cr_level = atoi(optarg);
- else
+ if (isdigit(*optarg)) {
+ cr_level = strtonum(optarg, 0, 10, &errstr);
+ if (errstr != NULL)
+ errx(1, "Invalid RAID level");
+ } else
cr_level = *optarg;
break;
case 'd':