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
This commit is contained in:
Tom Jones 2022-03-15 08:16:36 +00:00
parent 80c3eb7bc6
commit 81e0e7b9e3

View File

@ -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;