/proc/mounts contains device names that don't exist,
we end up erroring out because we're not able to stat
the device (that doesn't exist).
Fix this by allowing the mkfs when the target device doesn't exist.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
if(stat(a, &st_buf_a) < 0 ||
stat(b, &st_buf_b) < 0)
{
+ if (errno == ENOENT)
+ return 0;
return -errno;
}
/* Resolve a if it is a loop device */
if((ret = is_loop_device(a)) < 0) {
- return ret;
- } else if(ret) {
- if((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
+ if (ret == -ENOENT)
+ return 0;
+ return ret;
+ } else if (ret) {
+ if ((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
return ret;
final_a = res_a;
}
/* Resolve b if it is a loop device */
- if((ret = is_loop_device(b)) < 0) {
- return ret;
- } else if(ret) {
+ if ((ret = is_loop_device(b)) < 0) {
+ if (ret == -ENOENT)
+ return 0;
+ return ret;
+ } else if (ret) {
if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0)
return ret;