char *ep;
if (cname[0] == 'd')
sp++;
- num = strtoul(sp, &ep, 10);
+ if (isdigit(sp[0]))
+ num = strtoul(sp, &ep, 10);
+ else
+ ep = sp;
if (ep == sp || *ep || num < 0)
num = -1;
else if (cname[0] == 'd')
int cnlen;
strncpy(cname, name, 200);
cname[200] = 0;
- while ((cp = strchr(cname, '/')) != NULL)
- *cp = '-';
+ for (cp = cname; *cp ; cp++)
+ switch (*cp) {
+ case '/':
+ *cp = '-';
+ break;
+ case ' ':
+ case '\t':
+ *cp = '_';
+ break;
+ }
+
if (trustworthy == LOCAL ||
(trustworthy == FOREIGN && strchr(cname, ':') != NULL)) {
/* Only need suffix if there is a conflict */
* If we cannot detect udev, we need to make
* devices and links ourselves.
*/
- if ((stat("/dev/.udev", &stb) != 0 && stat("/run/udev", &stb) != 0) ||
- check_env("MDADM_NO_UDEV")) {
+ if (!use_udev()) {
/* Make sure 'devname' exists and 'chosen' is a symlink to it */
if (lstat(devname, &stb) == 0) {
/* Must be the correct device, else error */