mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ad723bbfe7
Use utils.Errorf instead of utils.Debugf
24 lines
474 B
Go
24 lines
474 B
Go
package docker
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"syscall"
|
|
)
|
|
|
|
func Mounted(mountpoint string) (bool, error) {
|
|
mntpoint, err := os.Stat(mountpoint)
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
return false, nil
|
|
}
|
|
return false, err
|
|
}
|
|
parent, err := os.Stat(filepath.Join(mountpoint, ".."))
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
mntpointSt := mntpoint.Sys().(*syscall.Stat_t)
|
|
parentSt := parent.Sys().(*syscall.Stat_t)
|
|
return mntpointSt.Dev != parentSt.Dev, nil
|
|
}
|