update for smartos build (solaris too) (#10378)

This commit is contained in:
Gaige B Paulsen
2020-08-31 13:19:25 -04:00
committed by GitHub
parent f04a1f220c
commit 859ef52886
5 changed files with 26 additions and 11 deletions

View File

@@ -215,7 +215,7 @@ func TestCheckPortAvailability(t *testing.T) {
for _, testCase := range testCases {
// On MS Windows and Mac, skip checking error case due to https://github.com/golang/go/issues/7598
if (runtime.GOOS == globalWindowsOSName || runtime.GOOS == globalMacOSName) && testCase.expectedErr != nil {
if (runtime.GOOS == globalWindowsOSName || runtime.GOOS == globalMacOSName || runtime.GOOS == "solaris") && testCase.expectedErr != nil {
continue
}

View File

@@ -83,7 +83,7 @@ func readDirN(dirPath string, count int) (entries []string, err error) {
}
return nil, osErrToFileErr(err)
}
if count > 0 {
if count > -1 {
if remaining <= len(fis) {
fis = fis[:remaining]
done = true

View File

@@ -68,12 +68,16 @@ func isSysErrTooManySymlinks(err error) bool {
return errors.Is(err, syscall.ELOOP)
}
// Check if the given error corresponds to ENOTEMPTY for unix
// Check if the given error corresponds to ENOTEMPTY for unix,
// EEXIST for solaris variants,
// and ERROR_DIR_NOT_EMPTY for windows (directory not empty).
func isSysErrNotEmpty(err error) bool {
if errors.Is(err, syscall.ENOTEMPTY) {
return true
}
if errors.Is(err, syscall.EEXIST) && runtime.GOOS == "solaris" {
return true
}
var pathErr *os.PathError
if errors.As(err, &pathErr) {
if runtime.GOOS == globalWindowsOSName {