Skip to content

Commit

Permalink
Merge pull request #4 from robertojrojas/missing_directory
Browse files Browse the repository at this point in the history
Check for missing directory error condition.
  • Loading branch information
briandowns authored Jun 11, 2018
2 parents bd760db + de2cdcb commit 21a4ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const (

// ErrjailNoFreeJIDFound [EAGAIN] No free JID could be found.
ErrjailNoFreeJIDFound = eagain

// ErrJailNoSuchFileDirectory [ENOENT] No such file or directory. A component of a specified pathname
// did not exist, or the pathname was an empty string.
ErrJailNoSuchFileDirectory = enoent
)

// The jail_set() system call will fail with one of the below errors
Expand Down
2 changes: 2 additions & 0 deletions jail.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func Jail(o *Opts) (int, error) {
return 0, fmt.Errorf("invalid version: %d", e1)
case ErrjailNoFreeJIDFound:
return 0, fmt.Errorf("no free JID found: %d", e1)
case ErrJailNoSuchFileDirectory:
return 0, fmt.Errorf("No such file or directory: %s\n", o.Path)
}
return 0, fmt.Errorf("%d", e1)
}
Expand Down

0 comments on commit 21a4ff2

Please sign in to comment.