diff options
Diffstat (limited to '')
-rw-r--r-- | mdopen.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -23,6 +23,7 @@ */ #include "mdadm.h" +#include "udev.h" #include "md_p.h" #include <ctype.h> @@ -176,7 +177,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, char devnm[32]; char cbuf[400]; - if (!use_udev()) + if (!udev_is_available()) block_udev = 0; if (chosen == NULL) @@ -335,8 +336,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, devnm[0] = 0; if (num < 0 && cname && ci->names) { sprintf(devnm, "md_%s", cname); - if (block_udev) - udev_block(devnm); + if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS) + return -1; if (!create_named_array(devnm)) { devnm[0] = 0; udev_unblock(); @@ -344,8 +345,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, } if (num >= 0) { sprintf(devnm, "md%d", num); - if (block_udev) - udev_block(devnm); + if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS) + return -1; if (!create_named_array(devnm)) { devnm[0] = 0; udev_unblock(); @@ -368,8 +369,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, return -1; } } - if (block_udev) - udev_block(devnm); + if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS) + return -1; create_named_array(devnm); } @@ -384,7 +385,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, * If we cannot detect udev, we need to make * devices and links ourselves. */ - if (!use_udev()) { + if (!udev_is_available()) { /* Make sure 'devname' exists and 'chosen' is a symlink to it */ if (lstat(devname, &stb) == 0) { /* Must be the correct device, else error */ @@ -508,7 +509,7 @@ char *find_free_devnm(int use_partitions) continue; if (!conf_name_is_free(devnm)) continue; - if (!use_udev()) { + if (!udev_is_available()) { /* make sure it is new to /dev too, at least as a * non-standard */ dev_t devid = devnm2devid(devnm); |