summaryrefslogtreecommitdiff
path: root/src/fcntl.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2015-02-26 17:45:01 -0800
committerCarl Lerche <me@carllerche.com>2015-02-27 11:14:38 -0800
commite8a58c83a50ef7e197767b5a491050ae91c9e503 (patch)
treec36a21e65ed26e7610d2182821a4a23f9dc4ee3f /src/fcntl.rs
parent8a7cd5675d38365d96e322693f455b2cd7fea6e5 (diff)
downloadnix-e8a58c83a50ef7e197767b5a491050ae91c9e503.zip
Further SockAddr & NixPath cleanup
Diffstat (limited to 'src/fcntl.rs')
-rw-r--r--src/fcntl.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index 53d055c0..30a59ed6 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -1,6 +1,6 @@
-use libc::mode_t;
+use {NixError, NixResult, NixPath, AsExtStr};
use errno::Errno;
-use {NixError, NixResult, NixPath};
+use libc::mode_t;
use sys::stat::Mode;
pub use self::consts::*;
@@ -71,11 +71,9 @@ mod ffi {
}
}
-pub fn open<P: NixPath>(path: P, oflag: OFlag, mode: Mode) -> NixResult<Fd> {
- let fd = try!(path.with_nix_path(|ptr| {
- unsafe {
- ffi::open(ptr, oflag.bits(), mode.bits() as mode_t)
- }
+pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> NixResult<Fd> {
+ let fd = try!(path.with_nix_path(|osstr| {
+ unsafe { ffi::open(osstr.as_ext_str(), oflag.bits(), mode.bits() as mode_t) }
}));
if fd < 0 {