rpms/smartmontools/devel smartmontools-5.37-addrinfo.patch, NONE, 1.1 smartmontools.spec, 1.35, 1.36
Tomas Smetana (tsmetana)
fedora-extras-commits at redhat.com
Fri Oct 12 13:26:31 UTC 2007
Author: tsmetana
Update of /cvs/pkgs/rpms/smartmontools/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8832
Modified Files:
smartmontools.spec
Added Files:
smartmontools-5.37-addrinfo.patch
Log Message:
* Fri Oct 12 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-7
- replace gethostbyname with getaddrinfo
smartmontools-5.37-addrinfo.patch:
--- NEW FILE smartmontools-5.37-addrinfo.patch ---
--- 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 @@
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. */
+ static char canon_name[NI_MAXHOST];
+ struct addrinfo *info;
+ int err;
+
+ if (err = getaddrinfo(hostname, NULL, NULL, &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);
+ p = canon_name;
+ if ((p = strchr(p, '.')))
+ p++;
#else
ARGUSED(hostname);
#endif
Index: smartmontools.spec
===================================================================
RCS file: /cvs/pkgs/rpms/smartmontools/devel/smartmontools.spec,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- smartmontools.spec 4 Sep 2007 11:59:22 -0000 1.35
+++ smartmontools.spec 12 Oct 2007 13:25:59 -0000 1.36
@@ -1,7 +1,7 @@
Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools
Version: 5.37
-Release: 6%{?dist}
+Release: 7%{?dist}
Epoch: 1
Group: System Environment/Base
License: GPLv2+
@@ -12,6 +12,7 @@
Source3: smartmontools.sysconf
Patch1: smartmontools-5.37-cloexec.patch
Patch2: smartmontools-5.37-3ware.patch
+Patch3: smartmontools-5.37-addrinfo.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
PreReq: /sbin/chkconfig /sbin/service
@@ -41,6 +42,7 @@
%setup -q
%patch1 -p1 -b .cloexec
%patch2 -p1 -b .3ware
+%patch3 -p1 -b .addrinfo
%build
%configure
@@ -91,6 +93,9 @@
%exclude %{_sbindir}/smartd-conf.py[co]
%changelog
+* Fri Oct 12 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-7
+- replace gethostbyname with getaddrinfo
+
* Tue Sep 04 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-6
- fix #271741 - smartd-conf.py should allow customization of parameters
- fix #253753 - service starting by default, perhaps shouldn't
More information about the fedora-extras-commits
mailing list