Article View: news.software.nn
Article #9608Patch to prevent nn from coring if NNTP server lookup fails
From: Andrew Gaylard
Date: Sat, 11 Nov 2000 00:00
Date: Sat, 11 Nov 2000 00:00
93 lines
4347 bytes
4347 bytes
Hi all,
I've just built nn-6.5.6 on Linux 2.2.14 (Redhat 6.2, if that makes any
difference), and since this is my laptop, it just so happened that nn
cored on startup.
A little digging with gdb, and it's fixed. (But please someone check
this -- I'm not a C expert by any means.)
Here's the patch:
{apg}~ : diff -c -r nn-6.5.6/nntp.c nn-6.5.6-new/nntp.c
*** nn-6.5.6/nntp.c Wed Jun 9 20:18:25 1999
--- nn-6.5.6-new/nntp.c Sat Nov 11 20:44:02 2000
***************
*** 761,766 ****
--- 761,767 ----
{
char host[128];
char *server_real_name;
+ struct hostent *server_hostent;
if (nntp_local_server) return;
***************
*** 768,774 ****
nn_gethostname(host, sizeof host);
strncpy(host, (gethostbyname(host))->h_name, sizeof host);
! server_real_name = (gethostbyname(nntp_server))->h_name;
use_nntp = (strcmp(host, server_real_name) != 0);
if (use_nntp) {
--- 769,781 ----
nn_gethostname(host, sizeof host);
strncpy(host, (gethostbyname(host))->h_name, sizeof host);
! server_hostent = gethostbyname(nntp_server);
! if (server_hostent == NULL) {
! printf ("NNTP server %s not found.\nNo news server (is bad news).\n", nntp_server);
! exit(1);
! } else {
! server_real_name = server_hostent->h_name;
! }
use_nntp = (strcmp(host, server_real_name) != 0);
if (use_nntp) {
Now, having got nn to run without coring, it doesn't display correctly
at all on Linux. This is what it looks like:
{apg}~/nn-6.5.6-new : nn
Connecting to NNTP server news.is.co.za ...
Connecting to NNTP server news.is.co.za ... ok (posting is allowed)
Release 6.5.6 #1 (NOV)
by Kim F. Storm, Peter Wemm, and Michael T Pins, 1999
NNTP>>> GROUP comp.editors NNTP<<< 211 162 20878 21039 comp.editorsNNTP>>> XOVER 21027-21039 NNTP<<< 224 data follows Newsgroup: comp.editorsArticles: 12 of 98/9a Rogers News 8 Where is vim 6.0a source for win32?b Stan Brown 17 >c i-8-1 K-F6hler- 22 >d bobhanson 19 Question re editors using interruptse bobhanson 19 -f B Macmillan 27 >>>>pronounciation of Vig B Macmillan 19 >>>>>>>>How to get rid of
the ^M character?h Maxim Ischenko 18 Vim buffer's numberingi Chris Speirs 35 >j Sven Guckes 38 >message formatting from within Vik David Rennalls 10 Strange Backspace on Solaris with Vim 5.7l-- 21:24 -- SELECT -- help:? -----All-----n Solaris
As you can see, it's totally unusable (this is an xterm, if that makes
any difference). I tried compiling with terminfo instead of termcap, but
the compile failed with these errors:
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h:90:
warning: `va_start' redefined
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/varargs.h:106:
warning: this is the location of the previous definition
term.c:882: macro `va_start' used with just one arg
term.c:1017: macro `va_start' used with just one arg
term.c:1090: macro `va_start' used with just one arg
term.c:2020: macro `va_start' used with just one arg
term.c:2037: macro `va_start' used with just one arg
term.c:2137: macro `va_start' used with just one arg
make[1]: *** [term.o] Error 1
make[1]: Leaving directory `/home/apg/nn-6.5.6-new'
make: *** [all] Error 2
BTW: Michael, when will we get our hands on the source of nn-7? Even a
pre-alpha version would be very useful, and I'm willing to help with the
work.
'Bye,
Andrew (Who's been using nn since 1991, on SunOS 4.1.x and
Irix-6.[35].x, and can't understand why it's so hard to build on Linux.)
--
--
Andrew Gaylard
andrew.gaylard @ za . didata . com
Technical Details
Message-ID:
<3a0d9ded$0$238@hades.is.co.za>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <3a0d9ded$0$238@hades.is.co.za> Subject: Patch to prevent nn from coring if NNTP server lookup fails Date: Sat, 11 Nov 2000 00:00:00 +0000 From: andrewg@no.spam.please.za.didata.com (Andrew Gaylard) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mail X-Deja-AN: 692475342 X-Trace: hades.is.co.za 973970925 238 196.38.213.1 Newsgroups: news.software.nn