fortify: fix up a few diagnostics; add __wur to realpath
As it says on the box.
Since realpath isn't a function definition, any attributes it provides
here just add to the "regular" realpath.
__wur is being added to realpath because it returns NULL on failure, and
the contents of the input buffer are undefined in that case. A blueline
checkbuild showed 0 complaints about this new __wur, so it seems
harmless to add.
Bug: 131861088
Test: mma
Change-Id: If5f47e0e290d86df69c0888711e29775c390fca4
diff --git a/libc/include/bits/fortify/stdlib.h b/libc/include/bits/fortify/stdlib.h
index 0bb3d0d..623be58 100644
--- a/libc/include/bits/fortify/stdlib.h
+++ b/libc/include/bits/fortify/stdlib.h
@@ -36,10 +36,11 @@
#define __PATH_MAX 4096
char* realpath(const char* path, char* resolved)
+ __clang_error_if(!path, "'realpath': NULL path is never correct; flipped arguments?")
__clang_error_if(__bos_unevaluated_lt(__bos(resolved), __PATH_MAX),
"'realpath' output parameter must be NULL or a pointer to a buffer "
- "with >= PATH_MAX bytes")
- __clang_error_if(!path, "'realpath': NULL path is never correct; flipped arguments?");
+ "with >= PATH_MAX bytes");
+
/* No need for a definition; the only issues we can catch are at compile-time. */
#undef __PATH_MAX