Skip to content

Commit fd01844

Browse files
committed
api: log when new bits appear
1 parent 4359fb5 commit fd01844

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ members = ["libkeyutils-sys"]
1818
bitflags = "~0.9"
1919
errno = "~0.2"
2020
libkeyutils-sys = { path = "libkeyutils-sys", version = "~0.3" }
21+
log = "~0.4"
2122

2223
libc = "~0.2"

src/api.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,16 @@ impl Description {
628628
None
629629
} else {
630630
if len > 5 {
631-
println!("New fields detected! Please report this upstream to \
632-
https://github.com/mathstuf/rust-keyutils: {}",
633-
desc);
631+
error!("New fields detected! Please report this upstream to \
632+
https://github.com/mathstuf/rust-keyutils: {}",
633+
desc);
634634
}
635635
let bits = KeyPermissions::from_str_radix(pieces[1], 16).unwrap();
636+
if Permission::from_bits(bits).is_none() {
637+
error!("New permission bits detected! Please report this upstream to \
638+
https://github.com/mathstuf/rust-keyutils: {}",
639+
bits);
640+
}
636641
Some(Description {
637642
type_: pieces[4].to_owned(),
638643
uid: pieces[3].parse::<libc::uid_t>().unwrap(),

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#![warn(missing_docs)]
3232

3333
#[macro_use] extern crate bitflags;
34+
#[macro_use] extern crate log;
3435

3536
mod crates {
3637
// public

0 commit comments

Comments
 (0)