- fix #359561 - typo in smartd-conf.py causes smartd to skip all disks
This commit is contained in:
parent
c878d0ab97
commit
72569964ad
@ -1,38 +1,55 @@
|
||||
--- smartmontools-5.37/smartd.cpp.addrinfo 2007-10-12 13:09:55.000000000 +0200
|
||||
+++ smartmontools-5.37/smartd.cpp 2007-10-12 13:11:41.000000000 +0200
|
||||
@@ -499,14 +499,28 @@
|
||||
Written-by: Tomas Smetana <tsmetana@redhat.com>
|
||||
Reviewed-by: Tomas Janousek <tjanouse@redhat.com>
|
||||
Reviewed-by: Karel Zak <kzak@redhat.com>
|
||||
|
||||
--- smartmontools-5.37/smartd.cpp.addrinfo 2007-10-15 16:53:37.000000000 +0200
|
||||
+++ smartmontools-5.37/smartd.cpp 2007-10-15 16:54:18.000000000 +0200
|
||||
@@ -498,7 +498,28 @@
|
||||
|
||||
char* dnsdomain(const char* hostname) {
|
||||
char *p = NULL;
|
||||
#ifdef HAVE_GETHOSTBYNAME
|
||||
- struct hostent *hp;
|
||||
-
|
||||
- if ((hp = gethostbyname(hostname))) {
|
||||
- // Does this work if gethostbyname() returns an IPv6 name in
|
||||
- // colon/dot notation? [BA]
|
||||
- if ((p = strchr(hp->h_name, '.')))
|
||||
- p++; // skip "."
|
||||
+ /* This is a Fedora specific patch. We KNOW that there is getaddrinfo
|
||||
+ * and getnameinfo. This part is not portable. */
|
||||
-#ifdef HAVE_GETHOSTBYNAME
|
||||
+#ifdef HAVE_GETADDRINFO
|
||||
+ static char canon_name[NI_MAXHOST];
|
||||
+ struct addrinfo *info;
|
||||
+ struct addrinfo *info = NULL;
|
||||
+ struct addrinfo hints;
|
||||
+ int err;
|
||||
+
|
||||
+ if (err = getaddrinfo(hostname, NULL, NULL, &info)) {
|
||||
+ memset(&hints, 0, sizeof(hints));
|
||||
+ hints.ai_flags = AI_CANONNAME;
|
||||
+ if ((err = getaddrinfo(hostname, NULL, &hints, &info)) || (!info)) {
|
||||
+ PrintOut(LOG_CRIT, "Error retrieving info for %s: %s\n",
|
||||
+ hostname, gai_strerror(err));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ canon_name[0] = '\0';
|
||||
+ if (err = getnameinfo(info->ai_addr, sizeof(struct sockaddr),
|
||||
+ canon_name, sizeof(canon_name), NULL, 0, 0)) {
|
||||
+ PrintOut(LOG_CRIT, "Error retrieving name info for %s: %s\n",
|
||||
+ hostname, gai_strerror(err));
|
||||
+ return NULL;
|
||||
}
|
||||
+ freeaddrinfo(info);
|
||||
+ if (info->ai_canonname) {
|
||||
+ strncpy(canon_name, info->ai_canonname, sizeof(canon_name));
|
||||
+ canon_name[NI_MAXHOST - 1] = '\0';
|
||||
+ p = canon_name;
|
||||
+ if ((p = strchr(p, '.')))
|
||||
+ if((p = strchr(canon_name, '.')))
|
||||
+ p++;
|
||||
+ }
|
||||
+ freeaddrinfo(info);
|
||||
+#elif HAVE_GETHOSTBYNAME
|
||||
struct hostent *hp;
|
||||
|
||||
if ((hp = gethostbyname(hostname))) {
|
||||
@@ -506,7 +527,7 @@
|
||||
// colon/dot notation? [BA]
|
||||
if ((p = strchr(hp->h_name, '.')))
|
||||
p++; // skip "."
|
||||
- }
|
||||
+ }
|
||||
#else
|
||||
ARGUSED(hostname);
|
||||
#endif
|
||||
--- smartmontools-5.37/configure.in.addrinfo 2006-12-20 21:39:25.000000000 +0100
|
||||
+++ smartmontools-5.37/configure.in 2007-10-15 16:53:37.000000000 +0200
|
||||
@@ -70,6 +70,7 @@
|
||||
AC_CHECK_FUNCS([getopt_long])
|
||||
AC_CHECK_FUNCS([getdomainname])
|
||||
AC_CHECK_FUNCS([gethostname])
|
||||
+AC_CHECK_FUNCS([getaddrinfo])
|
||||
AC_CHECK_FUNCS([gethostbyname])
|
||||
AC_CHECK_FUNCS([sigset])
|
||||
AC_CHECK_FUNCS([strtoull])
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Tools for monitoring SMART capable hard disks
|
||||
Name: smartmontools
|
||||
Version: 5.37
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Epoch: 1
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
@ -45,6 +45,7 @@ the /etc/smartd.conf configuration file.
|
||||
%patch3 -p1 -b .addrinfo
|
||||
|
||||
%build
|
||||
./autogen.sh
|
||||
%configure
|
||||
make CFLAGS="$RPM_OPT_FLAGS -fpie" LDFLAGS="-fpie -Wl,-z,relro,-z,now"
|
||||
|
||||
@ -93,6 +94,12 @@ exit 0
|
||||
%exclude %{_sbindir}/smartd-conf.py[co]
|
||||
|
||||
%changelog
|
||||
* Wed Oct 31 2007 Tomas Smetana <tsmetana@redhat.com> - 1:5.37-8
|
||||
- fix #359561 - typo in smartd-conf.py causes smartd to skip all disks
|
||||
|
||||
* Mon Oct 15 2007 Tomas Smetana <tsmetana@redhat.com> - 1:5.37-7.1
|
||||
- improved patch for getaddrinfo
|
||||
|
||||
* Fri Oct 12 2007 Tomas Smetana <tsmetana@redhat.com> - 1:5.37-7
|
||||
- replace gethostbyname with getaddrinfo
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user