diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/rustix/src/process/chdir.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 { |