git: 497aab21bd59 - stable/13 - bsnmpd: avoid warnings about too-long initializer strings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Dec 2025 12:24:04 UTC
The branch stable/13 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=497aab21bd59ee2b0d02970079ab556b15914578
commit 497aab21bd59ee2b0d02970079ab556b15914578
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-12-26 13:27:08 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-12-29 12:21:20 +0000
bsnmpd: avoid warnings about too-long initializer strings
Mark `UTC` as `__non_string`, to avoid a warning from clang 21 similar
to:
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c:339:29: error: initializer-string for character array is too long, array size is 3 but initializer has size 4 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
--- all_subdir_usr.sbin ---
339 | static const char UTC[3] = "UTC";
| ^~~~~
MFC after: 3 days
(cherry picked from commit 3054e22e4524df24908d7e9379681c1ccf829b93)
---
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
index 354ea2ece83a..3957e03a0fe3 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
@@ -336,7 +336,7 @@ static char *
snmp_date2asn_oid(char *str, struct asn_oid *oid)
{
char *endptr, *ptr;
- static const char UTC[3] = "UTC";
+ static const char UTC[3] __nonstring = "UTC";
int32_t saved_errno;
uint32_t v;