diff options
author | Arnavion <me@arnavion.dev> | 2022-03-13 17:33:02 -0700 |
---|---|---|
committer | Arnavion <me@arnavion.dev> | 2022-03-13 17:33:02 -0700 |
commit | cf628ca60907cbd50dfc30286b3ed3cdb6560ab2 (patch) | |
tree | 5a169aed98a53836ec1b952406115908f3b246ba /test | |
parent | 342585cf8e3459a7903c5db9282aa01a9f76ae42 (diff) | |
download | nix-cf628ca60907cbd50dfc30286b3ed3cdb6560ab2.zip |
Change getrlimit and setrlimit to use rlim_t directly.
Fixes #1666
Diffstat (limited to 'test')
-rw-r--r-- | test/test_resource.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test_resource.rs b/test/test_resource.rs index 59697500..c89d601e 100644 --- a/test/test_resource.rs +++ b/test/test_resource.rs @@ -12,9 +12,9 @@ use nix::sys::resource::{getrlimit, setrlimit, Resource}; #[test] #[cfg(not(any(target_os = "redox", target_os = "fuchsia", target_os = "illumos")))] pub fn test_resource_limits_nofile() { - let (soft_limit, hard_limit) = getrlimit(Resource::RLIMIT_NOFILE).unwrap(); + let (mut soft_limit, hard_limit) = getrlimit(Resource::RLIMIT_NOFILE).unwrap(); - let soft_limit = Some(soft_limit.map_or(1024, |v| v - 1)); + soft_limit -= 1; assert_ne!(soft_limit, hard_limit); setrlimit(Resource::RLIMIT_NOFILE, soft_limit, hard_limit).unwrap(); |