modified devices: filter /dev/console out of...

Applied crosbymichael's suggested changes

Signed-off-by: Alejandro Ojeda <alex@x3y.org>
This commit is contained in:
Alejandro Ojeda 2014-10-24 20:04:20 +02:00
parent 863a486d81
commit b7b7524f5f
1 changed files with 10 additions and 12 deletions

View File

@ -100,7 +100,8 @@ func getDeviceNodes(path string) ([]*Device, error) {
out := []*Device{} out := []*Device{}
for _, f := range files { for _, f := range files {
if f.IsDir() { switch {
case f.IsDir():
switch f.Name() { switch f.Name() {
case "pts", "shm", "fd": case "pts", "shm", "fd":
continue continue
@ -113,21 +114,18 @@ func getDeviceNodes(path string) ([]*Device, error) {
out = append(out, sub...) out = append(out, sub...)
continue continue
} }
case f.Name() == "console":
continue
} }
switch f.Name() { device, err := GetDevice(filepath.Join(path, f.Name()), "rwm")
case "console": if err != nil {
continue if err == ErrNotADeviceNode {
default: continue
device, err := GetDevice(filepath.Join(path, f.Name()), "rwm")
if err != nil {
if err == ErrNotADeviceNode {
continue
}
return nil, err
} }
out = append(out, device) return nil, err
} }
out = append(out, device)
} }
return out, nil return out, nil