rpms/slrn/devel slrn-0.9.8.1pl1-getaddr.patch, NONE, 1.1 slrn.spec, 1.31, 1.32

Miroslav Lichvar (mlichvar) fedora-extras-commits at redhat.com
Tue Oct 16 10:29:59 UTC 2007


Author: mlichvar

Update of /cvs/pkgs/rpms/slrn/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7127

Modified Files:
	slrn.spec 
Added Files:
	slrn-0.9.8.1pl1-getaddr.patch 
Log Message:
- don't use gethostbyname


slrn-0.9.8.1pl1-getaddr.patch:

--- NEW FILE slrn-0.9.8.1pl1-getaddr.patch ---
diff -up slrn-0.9.8.1pl1/src/misc.c.getaddr slrn-0.9.8.1pl1/src/misc.c
--- slrn-0.9.8.1pl1/src/misc.c.getaddr	2007-10-16 10:26:19.000000000 +0200
+++ slrn-0.9.8.1pl1/src/misc.c	2007-10-16 12:12:54.000000000 +0200
@@ -2808,10 +2808,14 @@ int slrn_is_fqdn (char *h) /*{{{*/
 /* Try to get a fully qualified domain name. */
 static char *get_hostname (void)
 {
+#ifdef HAVE_GETADDRINFO
+   struct addrinfo hint, *res;
+   int r;
+#else
    struct hostent *host_entry;
+#endif
    char buf[MAX_HOST_NAME_LEN + 1];
 
-   host_entry = NULL;
    if ((-1 == gethostname (buf, MAX_HOST_NAME_LEN))
        || (*buf == 0))
      return NULL;
@@ -2820,6 +2824,24 @@ static char *get_hostname (void)
     * to get more information.  Why isn't there a simplified interface to
     * get the FQDN!!!!
     */
+#ifdef HAVE_GETADDRINFO
+   memset(&hint, 0, sizeof (hint));
+   hint.ai_flags = AI_CANONNAME;
+
+   r = getaddrinfo(buf, NULL, &hint, &res);
+   if (r == EAI_AGAIN)
+     {
+	slrn_sleep (2);
+	r = getaddrinfo(buf, NULL, &hint, &res);
+     }
+
+   if (r == 0 && res && res->ai_canonname)
+     {
+	char *ret = slrn_safe_strmalloc (res->ai_canonname);
+	freeaddrinfo(res);
+	return ret;
+     }
+#else
    host_entry = gethostbyname (buf);
 
 #if defined(TRY_AGAIN) && !defined(MULTINET)
@@ -2850,6 +2872,7 @@ static char *get_hostname (void)
 	return slrn_safe_strmalloc ((char *)host_entry->h_name);
      }
    
+#endif 
    return slrn_safe_strmalloc (buf);
 }
 


Index: slrn.spec
===================================================================
RCS file: /cvs/pkgs/rpms/slrn/devel/slrn.spec,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- slrn.spec	24 Aug 2007 12:08:20 -0000	1.31
+++ slrn.spec	16 Oct 2007 10:29:26 -0000	1.32
@@ -1,7 +1,7 @@
 Summary: A threaded Internet news reader
 Name: slrn
 Version: 0.9.8.1pl1
-Release: 3.20070716cvs%{?dist}
+Release: 4.20070716cvs%{?dist}
 License: GPLv2+
 Group: Applications/Internet
 Source0: slrn-%{version}.tar.bz2
@@ -13,6 +13,7 @@
 Patch2: slrn-0.9.8.1pl1-asearch.patch
 Patch3: slrn-0.9.8.1pl1-20070716cvs.patch.bz2
 Patch4: slrn-0.9.8.1pl1-nss.patch
+Patch5: slrn-0.9.8.1pl1-getaddr.patch
 BuildRequires: automake autoconf gettext-devel
 BuildRequires: nss-devel nss_compat_ossl-devel slang-devel /usr/sbin/sendmail
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -42,6 +43,7 @@
 %patch2 -p1 -b .asearch
 %patch3 -p1
 %patch4 -p1 -b .nss
+%patch5 -p1 -b .getaddr
 
 %build
 sh ./autogen.sh -V
@@ -97,6 +99,9 @@
 %{_mandir}/man1/slrnpull.1*
 
 %changelog
+* Tue Oct 16 2007 Miroslav Lichvar <mlichvar at redhat.com> 0.9.8.1pl1-4.20070716cvs
+- don't use gethostbyname
+
 * Fri Aug 24 2007 Miroslav Lichvar <mlichvar at redhat.com> 0.9.8.1pl1-3.20070716cvs
 - update license tag
 - update from CVS




More information about the fedora-extras-commits mailing list