mirror of https://github.com/docker/docs.git
Check if the target loopback is a block device
This commit is contained in:
parent
1214b8897b
commit
8a5d927a53
|
|
@ -39,8 +39,9 @@ func openNextAvailableLoopback(index int, sparseFile *osFile) (loopFile *osFile,
|
||||||
return nil, ErrAttachLoopbackDevice
|
return nil, ErrAttachLoopbackDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Check here if target is a block device (in C: S_ISBLK(mode))
|
if fi.Mode()&osModeDevice != osModeDevice {
|
||||||
if fi.IsDir() {
|
utils.Errorf("Loopback device %s is not a block device.", target)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the targeted loopback (use OpenFile because Open sets O_CLOEXEC)
|
// Open the targeted loopback (use OpenFile because Open sets O_CLOEXEC)
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,10 @@ const (
|
||||||
sysSysIoctl = syscall.SYS_IOCTL
|
sysSysIoctl = syscall.SYS_IOCTL
|
||||||
sysEBusy = syscall.EBUSY
|
sysEBusy = syscall.EBUSY
|
||||||
|
|
||||||
osORdOnly = os.O_RDONLY
|
osORdOnly = os.O_RDONLY
|
||||||
osORdWr = os.O_RDWR
|
osORdWr = os.O_RDWR
|
||||||
osOCreate = os.O_CREATE
|
osOCreate = os.O_CREATE
|
||||||
|
osModeDevice = os.ModeDevice
|
||||||
)
|
)
|
||||||
|
|
||||||
func toSysStatT(i interface{}) *sysStatT {
|
func toSysStatT(i interface{}) *sysStatT {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue