diff options
Diffstat (limited to 'vendor/rustix/src/process/chdir.rs')
-rw-r--r-- | vendor/rustix/src/process/chdir.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/vendor/rustix/src/process/chdir.rs b/vendor/rustix/src/process/chdir.rs index b110afef8..a68352f0e 100644 --- a/vendor/rustix/src/process/chdir.rs +++ b/vendor/rustix/src/process/chdir.rs @@ -67,15 +67,18 @@ fn _getcwd(mut buffer: Vec<u8>) -> io::Result<CString> { loop { match backend::process::syscalls::getcwd(buffer.spare_capacity_mut()) { Err(io::Errno::RANGE) => { - buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially + // Use `Vec` reallocation strategy to grow capacity + // exponentially. + buffer.reserve(buffer.capacity() + 1); } Ok(_) => { // SAFETY: // - "These functions return a null-terminated string" - // - [POSIX definition 3.375: String]: "A contiguous sequence of bytes - // terminated by and including the first null byte." + // - [POSIX definition 3.375: String]: "A contiguous sequence + // of bytes terminated by and including the first null byte." // - // Thus, there will be a single NUL byte at the end of the string. + // Thus, there will be a single NUL byte at the end of the + // string. // // [POSIX definition 3.375: String]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_375 unsafe { |