public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/slrn] epel10: - don't use gethostbyname
@ 2026-10-14 13:16 Miroslav Lichvar
  0 siblings, 0 replies; only message in thread
From: Miroslav Lichvar @ 2026-10-14 13:16 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/slrn
Branch : epel10
Commit : fa4078217e602cce4ce9d09efe1416d79b5ebb6e
Author : Miroslav Lichvar <mlichvar@fedoraproject.org>
Date   : 2007-10-16T10:29:26+00:00
Stats  : +58/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/slrn/c/fa4078217e602cce4ce9d09efe1416d79b5ebb6e?branch=epel10

Log:
- don't use gethostbyname

---
diff --git a/slrn-0.9.8.1pl1-getaddr.patch b/slrn-0.9.8.1pl1-getaddr.patch
new file mode 100644
index 0000000..d8ddf0f
--- /dev/null
+++ b/slrn-0.9.8.1pl1-getaddr.patch
@@ -0,0 +1,52 @@
+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);
+ }
+ 

diff --git a/slrn.spec b/slrn.spec
index 3729aa8..a71499b 100644
--- a/slrn.spec
+++ b/slrn.spec
@@ -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 @@ Patch1: slrn-scorefile.patch
 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 @@ the slrnpull utility.
 %patch2 -p1 -b .asearch
 %patch3 -p1
 %patch4 -p1 -b .nss
+%patch5 -p1 -b .getaddr
 
 %build
 sh ./autogen.sh -V
@@ -97,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/slrnpull.1*
 
 %changelog
+* Tue Oct 16 2007 Miroslav Lichvar <mlichvar@redhat.com> 0.9.8.1pl1-4.20070716cvs
+- don't use gethostbyname
+
 * Fri Aug 24 2007 Miroslav Lichvar <mlichvar@redhat.com> 0.9.8.1pl1-3.20070716cvs
 - update license tag
 - update from CVS

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-14 13:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14 13:16 [rpms/slrn] epel10: - don't use gethostbyname Miroslav Lichvar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox