We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 36aa5f4 + 33a0764 commit 7fbedf5Copy full SHA for 7fbedf5
src/lib.rs
@@ -1542,7 +1542,27 @@ impl Bindings {
1542
}
1543
1544
1545
+ #[cfg(unix)]
1546
+ fn can_read(perms: &std::fs::Permissions) -> bool {
1547
+ use std::os::unix::fs::PermissionsExt;
1548
+ perms.mode() & 0o444 > 0
1549
+ }
1550
+
1551
+ #[cfg(not(unix))]
1552
+ fn can_read(_: &std::fs::Permissions) -> bool {
1553
+ true
1554
1555
1556
if let Some(h) = options.input_header.as_ref() {
1557
+ let md = std::fs::metadata(h).ok().unwrap();
1558
+ if !md.is_file() {
1559
+ eprintln!("error: '{}' is a folder", h);
1560
+ return Err(());
1561
1562
+ if !can_read(&md.permissions()) {
1563
+ eprintln!("error: insufficient permissions to read '{}'", h);
1564
1565
1566
options.clang_args.push(h.clone())
1567
1568
0 commit comments