diff options
| author | jvoisin | 2023-09-11 17:55:38 +0200 |
|---|---|---|
| committer | jvoisin | 2023-09-11 17:55:38 +0200 |
| commit | f3c9815580f7e2684a7f517a4e656f13e4347e77 (patch) | |
| tree | 02224b0ef4435b6f7a36cda77d01b777846f7e0d | |
| parent | 5ce4b94b7ac1d529b42ac76609b686d1ba0dffcb (diff) | |
Add a warning if realpath is called with path set to NULL
| -rw-r--r-- | include/stdlib.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 2671280..1a92bff 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
| @@ -80,6 +80,7 @@ _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) | |||
| 80 | #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) | 80 | #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) |
| 81 | #undef realpath | 81 | #undef realpath |
| 82 | __diagnose_as_builtin(__builtin_realpath, 1, 2) | 82 | __diagnose_as_builtin(__builtin_realpath, 1, 2) |
| 83 | __warning_if(__p == NULL, "'realpath' called with path set to `NULL`; did you invert the arguments?") | ||
| 83 | _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) | 84 | _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) |
| 84 | { | 85 | { |
| 85 | #ifndef PATH_MAX | 86 | #ifndef PATH_MAX |
