We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a552dd9 commit e41e233Copy full SHA for e41e233
library/std/src/sys/pal/unix/fs.rs
@@ -1498,6 +1498,16 @@ impl fmt::Debug for File {
1498
let mut buf = vec![0; libc::PATH_MAX as usize];
1499
let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr()) };
1500
if n == -1 {
1501
+ cfg_if::cfg_if! {
1502
+ if #[cfg(target_os = "netbsd")] {
1503
+ // fallback to procfs as last resort
1504
+ let mut p = PathBuf::from("/proc/self/fd");
1505
+ p.push(&fd.to_string());
1506
+ if p.exists() {
1507
+ return readlink(&p).ok();
1508
+ }
1509
1510
1511
return None;
1512
}
1513
let l = buf.iter().position(|&c| c == 0).unwrap();
0 commit comments