summaryrefslogtreecommitdiff
path: root/src/nix.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix.rs')
-rw-r--r--src/nix.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix.rs b/src/nix.rs
index e59ceaed..3cc5beff 100644
--- a/src/nix.rs
+++ b/src/nix.rs
@@ -1,7 +1,7 @@
use libc;
use std;
-use errno::Errno;
+use errno::{Errno, EINVAL};
pub type NixResult<T> = Result<T, NixError>;
@@ -11,6 +11,12 @@ pub enum NixError {
InvalidPath
}
+impl NixError {
+ pub fn invalid_argument() -> NixError {
+ NixError::Sys(EINVAL)
+ }
+}
+
pub trait NixPath {
fn with_nix_path<T, F>(&self, f: F) -> Result<T, NixError>
where F: FnOnce(*const libc::c_char) -> T;