Skip to content

Commit

Permalink
fix compiling issue on 32bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
mitnk committed Jan 23, 2021
1 parent c06401c commit c32c859
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Logs

## 0.9.18 - master

- fix compiling issue on 32bit systems.

## 0.9.17 - 2021-01-10

- Fix & improved the builtin `ulimit`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
edition = "2018"
build = "src/build.rs"
name = "cicada"
version = "0.9.17"
version = "0.9.18"
authors = ["Hugo Wang <[email protected]>"]

description = "A simple Bash-like Unix shell."
Expand Down
11 changes: 9 additions & 2 deletions src/builtins/ulimit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ fn set_limit(limit_name: &str, value: u64, for_hard: bool) -> bool {
}

if for_hard {
rlp.rlim_max = value;
#[cfg(target_pointer_width = "32")]
{ rlp.rlim_max = value as u32; }
#[cfg(target_pointer_width = "64")]
{ rlp.rlim_max = value; }
} else {
rlp.rlim_cur = value;
#[cfg(target_pointer_width = "32")]
{ rlp.rlim_cur = value as u32; }
#[cfg(target_pointer_width = "64")]
{ rlp.rlim_cur = value; }
}

unsafe {
let res = libc::setrlimit(limit_id, rlim);
if res != 0 {
Expand Down

0 comments on commit c32c859

Please sign in to comment.