diff --git a/src/header/limits/mod.rs b/src/header/limits/mod.rs index c7de1bb3e5..462a76f5cb 100644 --- a/src/header/limits/mod.rs +++ b/src/header/limits/mod.rs @@ -101,6 +101,7 @@ pub const _POSIX_SIGQUEUE_MAX: c_long = 32; pub const _POSIX_SSIZE_MAX: c_long = 32767; pub const _POSIX_STREAM_MAX: c_long = 8; pub const _POSIX_SYMLINK_MAX: c_long = 255; +/// Minimum required value for `SYMLOOP_MAX`. pub const _POSIX_SYMLOOP_MAX: c_long = 8; pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: c_long = 4; pub const _POSIX_THREAD_KEYS_MAX: c_long = 128; @@ -145,5 +146,7 @@ pub const PTHREAD_DESTRUCTOR_ITERATIONS: c_long = _POSIX_THREAD_DESTRUCTOR_ITERA // TODO: What should this limit be? Both glibc and musl have it as 1024 pub const PTHREAD_KEYS_MAX: c_long = 4096 * 32; pub const PTHREAD_STACK_MIN: c_long = 65536; +/// Maximum number of symbolic links that can be reliably traversed in the +/// resolution of a pathname in the absence of a loop. pub const SYMLOOP_MAX: c_long = 64; pub const TTY_NAME_MAX: c_long = 32; // "/scheme/pty/".len() + size of usize::MAX as string + 1 diff --git a/src/platform/redox/path.rs b/src/platform/redox/path.rs index 32b35ff618..4151016eb0 100644 --- a/src/platform/redox/path.rs +++ b/src/platform/redox/path.rs @@ -272,10 +272,8 @@ fn calc_next_abs_path(current_abs: &str, link_target: &str) -> Result { } fn resolve_sym_links(mut current_path_string: String, flags: usize) -> Result { - // TODO: SYMLOOP_MAX - const MAX_LEVEL: usize = 64; // Sym reolve loop - for _ in 0..(MAX_LEVEL - 1) { + for _ in 0..limits::SYMLOOP_MAX { match open_absolute(¤t_path_string, flags) { Ok(fd) => return Ok(fd), Err(e) if e == Error::new(EXDEV) => {