lucab / caps-rs

A pure-Rust library to work with Linux capabilities
https://docs.rs/caps
Other
83 stars 20 forks source link

Type error on x86_32 #17

Closed Ongy closed 6 years ago

Ongy commented 6 years ago

When trying to compile this crate on a x86_32 linux machine I get a type error because nr::{CapSet, CapGet} are i64 but libc::syscall expects an i32.

lucab commented 6 years ago

What's the error you get? Would you mind doing a sudo cargo test with your patch and see if everything else is fine?

Ongy commented 6 years ago
   Compiling caps v0.1.1-alpha.0 (file:///tmp/fail)
error[E0308]: mismatched types
  --> src/base.rs:11:36
   |
11 |     let r = unsafe { libc::syscall(nr::CAPGET, hdr, data) };
   |                                    ^^^^^^^^^^ expected i32, found i64

error[E0308]: mismatched types
  --> src/base.rs:19:36
   |
19 |     let r = unsafe { libc::syscall(nr::CAPSET, hdr, data) };
   |                                    ^^^^^^^^^^ expected i32, found i64

error: aborting due to 2 previous errors

error: Could not compile `caps`.

To learn more, run the command again with --verbose.

Running cargo test with my patch to get it to compile doesn't produce any errors

lucab commented 6 years ago

Great, thanks! Would you like to submit a PR with that patch yourself?

Ongy commented 6 years ago

Sure https://github.com/lucab/caps-rs/pull/18 :)