From 4cc7e0862826e6703642cfbf6440e3ef8fd8da0e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Jun 2017 12:23:52 +0200 Subject: all: use osutil.IsExist instead of os.Stat --- host/host.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'host') diff --git a/host/host.go b/host/host.go index 513f119ac..4e634f1aa 100644 --- a/host/host.go +++ b/host/host.go @@ -6,12 +6,12 @@ package host import ( "bytes" "io/ioutil" - "os" "runtime" "strconv" "strings" "syscall" + "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/sys" ) @@ -79,8 +79,7 @@ func isSupportedSyzkall(c *sys.Call) bool { var check func(dev string) bool check = func(dev string) bool { if !strings.Contains(dev, "#") { - _, err := os.Stat(dev) - return err == nil + return osutil.IsExist(dev) } for i := 0; i < 10; i++ { if check(strings.Replace(dev, "#", strconv.Itoa(i), 1)) { @@ -93,11 +92,9 @@ func isSupportedSyzkall(c *sys.Call) bool { case "syz_open_pts": return true case "syz_fuse_mount": - _, err := os.Stat("/dev/fuse") - return err == nil + return osutil.IsExist("/dev/fuse") case "syz_fuseblk_mount": - _, err := os.Stat("/dev/fuse") - return err == nil && syscall.Getuid() == 0 + return osutil.IsExist("/dev/fuse") && syscall.Getuid() == 0 case "syz_emit_ethernet", "syz_extract_tcp_res": fd, err := syscall.Open("/dev/net/tun", syscall.O_RDWR, 0) if err == nil { -- cgit mrf-deployment