strcpy(new+7, new+8);
else
new[7] = '_';
- symlink(dev+5, new);
+ if (symlink(dev+5, new))
+ perror(new);
}
dev);
return -1;
}
- if (autof == 2 && stb.st_mode == 0 && !is_standard(dev, NULL)) {
- fprintf(stderr, Name ": --auto=yes requires a 'standard' md device name, not %s\n", dev);
- return -1;
- }
/* check major number is correct */
num = -1;
std = is_standard(dev, &num);
switch(autof) {
case 2: /* only create is_standard names */
if (!std && !stb.st_mode) {
- fprintf(stderr, Name ": --auto=yes requires a 'standard' md device name, not %s\n", dev);
+ fprintf(stderr, Name
+ ": %s does not exist and is not a 'standard' name "
+ "so it cannot be created\n", dev);
return -1;
}
break;
case 3: /* create md, reject std>0 */
if (std > 0) {
- fprintf(stderr, Name ": that --auto option not compatable with device named %s\n", dev);
+ fprintf(stderr, Name ": that --auto option "
+ "not compatable with device named %s\n", dev);
return -1;
}
break;
case 4: /* create mdp, reject std<0 */
if (std < 0) {
- fprintf(stderr, Name ": that --auto option not compatable with device named %s\n", dev);
+ fprintf(stderr, Name ": that --auto option "
+ "not compatable with device named %s\n", dev);
return -1;
}
break;
if (stb.st_mode && major(stb.st_rdev) != major)
must_remove = 1;
if (stb.st_mode && !must_remove) {
- mdu_array_info_t array;
/* looks ok, see if it is available */
mdfd = open(dev, O_RDWR, 0);
if (mdfd < 0) {
close(mdfd);
return -1;
}
- if (ioctl(mdfd, GET_ARRAY_INFO, &array)==0) {
- /* already active */
- close(mdfd);
- fprintf(stderr, Name ": %s is already active.\n",
- dev);
- return -1;
- } else {
- if (major != MD_MAJOR && parts > 0)
- make_parts(dev, parts, ci->symlinks);
- return mdfd;
- }
+ if (major != MD_MAJOR && parts > 0)
+ make_parts(dev, parts, ci->symlinks);
+ return mdfd;
}
/* Ok, need to find a minor that is not in use.
* If the device name is in a 'standard' format,
if (strncmp(dev, "/dev/md/", 8) == 0) {
if (mkdir("/dev/md",0700)==0) {
- chown("/dev/md", ci->uid, ci->gid);
- chmod("/dev/md", ci->mode| ((ci->mode>>2) & 0111));
+ if (chown("/dev/md", ci->uid, ci->gid))
+ perror("chown /dev/md");
+ if (chmod("/dev/md", ci->mode| ((ci->mode>>2) & 0111)))
+ perror("chmod /dev/md");
}
}
if (mknod(dev, S_IFBLK|0600, makedev(major, minor))!= 0) {