|
|
@ -27,13 +27,9 @@ func isSysErrNoSys(err error) bool { |
|
|
|
if err == syscall.ENOSYS { |
|
|
|
if err == syscall.ENOSYS { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.ENOSYS |
|
|
|
case syscall.ENOSYS: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Not supported error
|
|
|
|
// Not supported error
|
|
|
@ -41,13 +37,9 @@ func isSysErrOpNotSupported(err error) bool { |
|
|
|
if err == syscall.EOPNOTSUPP { |
|
|
|
if err == syscall.EOPNOTSUPP { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.EOPNOTSUPP |
|
|
|
case syscall.EOPNOTSUPP: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// No space left on device error
|
|
|
|
// No space left on device error
|
|
|
@ -55,13 +47,8 @@ func isSysErrNoSpace(err error) bool { |
|
|
|
if err == syscall.ENOSPC { |
|
|
|
if err == syscall.ENOSPC { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.ENOSPC |
|
|
|
case syscall.ENOSPC: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Input/output error
|
|
|
|
// Input/output error
|
|
|
@ -69,13 +56,8 @@ func isSysErrIO(err error) bool { |
|
|
|
if err == syscall.EIO { |
|
|
|
if err == syscall.EIO { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.EIO |
|
|
|
case syscall.EIO: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if the given error corresponds to EISDIR (is a directory).
|
|
|
|
// Check if the given error corresponds to EISDIR (is a directory).
|
|
|
@ -83,13 +65,9 @@ func isSysErrIsDir(err error) bool { |
|
|
|
if err == syscall.EISDIR { |
|
|
|
if err == syscall.EISDIR { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.EISDIR |
|
|
|
case syscall.EISDIR: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if the given error corresponds to ENOTDIR (is not a directory).
|
|
|
|
// Check if the given error corresponds to ENOTDIR (is not a directory).
|
|
|
@ -97,13 +75,8 @@ func isSysErrNotDir(err error) bool { |
|
|
|
if err == syscall.ENOTDIR { |
|
|
|
if err == syscall.ENOTDIR { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.ENOTDIR |
|
|
|
case syscall.ENOTDIR: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if the given error corresponds to the ENAMETOOLONG (name too long).
|
|
|
|
// Check if the given error corresponds to the ENAMETOOLONG (name too long).
|
|
|
@ -111,13 +84,8 @@ func isSysErrTooLong(err error) bool { |
|
|
|
if err == syscall.ENAMETOOLONG { |
|
|
|
if err == syscall.ENAMETOOLONG { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
if pathErr, ok := err.(*os.PathError); ok { |
|
|
|
pathErr, ok := err.(*os.PathError) |
|
|
|
switch pathErr.Err { |
|
|
|
return ok && pathErr.Err == syscall.ENAMETOOLONG |
|
|
|
case syscall.ENAMETOOLONG: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if the given error corresponds to ENOTEMPTY for unix
|
|
|
|
// Check if the given error corresponds to ENOTEMPTY for unix
|
|
|
@ -133,8 +101,7 @@ func isSysErrNotEmpty(err error) bool { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
switch pathErr.Err { |
|
|
|
if pathErr.Err == syscall.ENOTEMPTY { |
|
|
|
case syscall.ENOTEMPTY: |
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -161,15 +128,11 @@ func isSysErrHandleInvalid(err error) bool { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
// Check if err contains ERROR_INVALID_HANDLE errno
|
|
|
|
// Check if err contains ERROR_INVALID_HANDLE errno
|
|
|
|
if errno, ok := err.(syscall.Errno); ok && errno == 0x6 { |
|
|
|
errno, ok := err.(syscall.Errno) |
|
|
|
return true |
|
|
|
return ok && errno == 0x6 |
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func isSysErrCrossDevice(err error) bool { |
|
|
|
func isSysErrCrossDevice(err error) bool { |
|
|
|
if e, ok := err.(*os.LinkError); ok { |
|
|
|
e, ok := err.(*os.LinkError) |
|
|
|
return e.Err == syscall.EXDEV |
|
|
|
return ok && e.Err == syscall.EXDEV |
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|