git: d4f042f094ec - main - libbsnmp: fix local client socket creation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Jul 2025 15:59:07 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=d4f042f094ec31447f127d6c4e15a8366dd32725
commit d4f042f094ec31447f127d6c4e15a8366dd32725
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-07-17 15:57:56 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-07-17 15:57:56 +0000
libbsnmp: fix local client socket creation
Revert "bsnmp: Use mkstemp when creating clients local socket"
The use of mktemp() was intentional here. We don't want a regular file to
be created. If created, it guarantees that following bind(2) would always
fail with EADDRINUSE and thus open_client_local() always fails.
This reverts commit 81e0e7b9e36d6a25b3af6482811318e085537d2f.
Reviewed by: rew, harti
Differential Revision: https://reviews.freebsd.org/D51031
---
contrib/bsnmp/lib/snmpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c
index b312a37ed3ed..a7556527ad51 100644
--- a/contrib/bsnmp/lib/snmpclient.c
+++ b/contrib/bsnmp/lib/snmpclient.c
@@ -1012,7 +1012,7 @@ open_client_local(const char *path)
snprintf(snmp_client.local_path, sizeof(snmp_client.local_path),
"%s", SNMP_LOCAL_PATH);
- if (mkstemp(snmp_client.local_path) == -1) {
+ if (mktemp(snmp_client.local_path) == NULL) {
seterr(&snmp_client, "%s", strerror(errno));
(void)close(snmp_client.fd);
snmp_client.fd = -1;