Daily bump.
[official-gcc.git] / libgo / go / os / error_unix.go
blob6250349e5bad33715ac232e54aa93028ffb6f870
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build darwin dragonfly freebsd linux netbsd openbsd
7 package os
9 import "syscall"
11 func isExist(err error) bool {
12 switch pe := err.(type) {
13 case nil:
14 return false
15 case *PathError:
16 err = pe.Err
17 case *LinkError:
18 err = pe.Err
20 return err == syscall.EEXIST || err == ErrExist
23 func isNotExist(err error) bool {
24 switch pe := err.(type) {
25 case nil:
26 return false
27 case *PathError:
28 err = pe.Err
29 case *LinkError:
30 err = pe.Err
32 return err == syscall.ENOENT || err == ErrNotExist
35 func isPermission(err error) bool {
36 switch pe := err.(type) {
37 case nil:
38 return false
39 case *PathError:
40 err = pe.Err
41 case *LinkError:
42 err = pe.Err
44 return err == syscall.EACCES || err == syscall.EPERM || err == ErrPermission