[libcxx-commits] [libcxx] [libc++][hardening] Classify assertions related to leaks and syscalls. (PR #77164)
    Will Hawkins via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Fri Jan  5 18:34:23 PST 2024
    
    
  
================
@@ -461,7 +461,7 @@ path __current_path(error_code* ec) {
   Deleter deleter = &::free;
 #else
   auto size = ::pathconf(".", _PC_PATH_MAX);
-  _LIBCPP_ASSERT_UNCATEGORIZED(size >= 0, "pathconf returned a 0 as max size");
+  _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(size >= 0, "pathconf returned a 0 as max size");
----------------
hawkinsw wrote:
Here is something interesting that I found from the `man` page:
```
       •  If name corresponds to a maximum or minimum limit, and that limit is
          indeterminate, -1 is returned and errno is not changed.  (To distin‐
          guish an indeterminate limit from an error, set errno to zero before
          the call, and then check whether errno is nonzero  when  -1  is  re‐
          turned.)
```
So, perhaps, there could be a platform out there that has an indeterminate maximum path length that could return `-1` and mean that it was not an error?
https://github.com/llvm/llvm-project/pull/77164
    
    
More information about the libcxx-commits
mailing list