summaryrefslogtreecommitdiff
path: root/src/nix.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2015-02-23 22:58:18 -0800
committerCarl Lerche <me@carllerche.com>2015-02-23 22:58:18 -0800
commitfcc952a18c054821480964bc1b0f7b32e7728e62 (patch)
treeb922a4d92c6a7e23fe5181d911a6f7200755b4e2 /src/nix.rs
parent979faf097691dc35bb12b91dcde0d804a3d32b79 (diff)
downloadnix-fcc952a18c054821480964bc1b0f7b32e7728e62.zip
in_addr conversions + IP_DROP_MEMBERSHIP support
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;