| diff -Naur monit-5.4/src/util.c monit-edited/src/util.c |
| --- monit-5.4/src/util.c 2012-05-06 02:40:45.000000000 -0700 |
| +++ monit-edited/src/util.c 2016-03-14 11:48:27.047055577 -0700 |
| @@ -1886,9 +1886,7 @@ |
| |
| |
| int Util_getfqdnhostname(char *buf, unsigned len) { |
| - int status; |
| char hostname[STRLEN]; |
| - struct addrinfo hints, *info = NULL; |
| |
| // Set the base hostname |
| if (gethostname(hostname, sizeof(hostname))) { |
| @@ -1896,24 +1894,6 @@ |
| return -1; |
| } |
| snprintf(buf, len, "%s", hostname); |
| - |
| - // Try to look for FQDN hostname |
| - memset(&hints, 0, sizeof(hints)); |
| - hints.ai_family = AF_UNSPEC; |
| - hints.ai_socktype = SOCK_STREAM; |
| - hints.ai_flags = AI_CANONNAME; |
| - if ((status = getaddrinfo(hostname, NULL, &hints, &info))) { |
| - LogError("%s: Cannot translate '%s' to FQDN name -- %s\n", prog, hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); |
| - } else { |
| - for (struct addrinfo *result = info; result; result = result->ai_next) { |
| - if (Str_startsWith(result->ai_canonname, hostname)) { |
| - snprintf(buf, len, "%s", result->ai_canonname); |
| - break; |
| - } |
| - } |
| - } |
| - if (info) |
| - freeaddrinfo(info); |
| return 0; |
| } |
| |