Skip to content

Commit f5b1acf

Browse files
committed
Don't open /proc directories with NOATIME or PATH.
Linux 2.6.32 doesn't support `OFlags::NOATIME` or `OFlags::PATH` on /proc. These flags aren't essential, so just disable them for now.
1 parent 96b6768 commit f5b1acf

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/io/procfs.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,8 @@ fn is_mountpoint(file: BorrowedFd<'_>) -> bool {
209209

210210
/// Open a directory in `/proc`, mapping all errors to `io::Error::NOTSUP`.
211211
fn proc_opendirat<P: crate::path::Arg, Fd: AsFd>(dirfd: &Fd, path: P) -> io::Result<OwnedFd> {
212-
let oflags = OFlags::NOFOLLOW
213-
| OFlags::PATH
214-
| OFlags::DIRECTORY
215-
| OFlags::CLOEXEC
216-
| OFlags::NOCTTY
217-
| OFlags::NOATIME;
212+
// We could add `PATH`|`NOATIME` here but Linux 2.6.32 doesn't support it.
213+
let oflags = OFlags::NOFOLLOW | OFlags::DIRECTORY | OFlags::CLOEXEC | OFlags::NOCTTY;
218214
openat(dirfd, path, oflags, Mode::empty()).map_err(|_err| io::Error::NOTSUP)
219215
}
220216

0 commit comments

Comments
 (0)