1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

MemorySanitizer: Avoid calling uninstrumented getservbyname()

This commit is contained in:
Marko Mäkelä
2020-03-28 20:12:43 +02:00
parent aa8b13092c
commit 7a2c052ffc

View File

@@ -39,6 +39,10 @@
#include <time.h>
#include <mariadb_dyncol.h>
#ifndef __has_feature
# define __has_feature(x) 0
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
@@ -3720,12 +3724,16 @@ static void mysql_once_init()
}
if (!mysql_port)
{
#if !__has_feature(memory_sanitizer) /* work around MSAN deficiency */
struct servent *serv_ptr;
#endif
char *env;
mysql_port = MARIADB_PORT;
#if !__has_feature(memory_sanitizer) /* work around MSAN deficiency */
if ((serv_ptr = getservbyname("mysql", "tcp")))
mysql_port = (uint)ntohs((ushort)serv_ptr->s_port);
#endif
if ((env = getenv("MYSQL_TCP_PORT")))
mysql_port =(uint)atoi(env);
}