git: 81e0e7b9e36d - main - bsnmp: Use mkstemp when creating clients local socket

From: Tom Jones <thj_at_FreeBSD.org>
Date: Tue, 15 Mar 2022 08:20:55 UTC
The branch main has been updated by thj:

URL: https://cgit.FreeBSD.org/src/commit/?id=81e0e7b9e36d6a25b3af6482811318e085537d2f

commit 81e0e7b9e36d6a25b3af6482811318e085537d2f
Author:     Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-03-15 08:16:36 +0000
Commit:     Tom Jones <thj@FreeBSD.org>
CommitDate: 2022-03-15 08:20:13 +0000

    bsnmp: Use mkstemp when creating clients local socket
    
    Reviewed by:    harti, rew
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    X-NetApp-PR:    #72
    Differential Revision:  https://reviews.freebsd.org/D34550
---
 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 05711e341fd7..ab3ac2d18e64 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 (mktemp(snmp_client.local_path) == NULL) {
+	if (mkstemp(snmp_client.local_path) == -1) {
 		seterr(&snmp_client, "%s", strerror(errno));
 		(void)close(snmp_client.fd);
 		snmp_client.fd = -1;