searching for John O Sullivan [Mailer-Daemon@master.debian.org: Mail delivery failed: returning message to sender]
----- Forwarded message from Mail Delivery System <Mailer-Daemon@master.debian.org> -----
Delivery-date: Wed, 01 Aug 2001 04:07:25 +0200
X-Failed-Recipients: johno@cruithne.org
From: Mail Delivery System <Mailer-Daemon@master.debian.org>
To: owner@bugs.debian.org
Subject: Mail delivery failed: returning message to sender
Date: Tue, 31 Jul 2001 21:04:47 -0500
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. The following address(es) failed:
johno@cruithne.org:
retry time not reached for any host after a long failure period
------ This is a copy of the message, including all the headers. ------
Return-path: <owner@bugs.debian.org>
Received: from gecko by master.debian.org with local (Exim 3.12 1 (Debian))
id 15RlNN-00020N-00; Tue, 31 Jul 2001 21:04:45 -0500
Subject: Bug#107314: [patch] xfrisk for GNU HURD, sys_errlist -> strerror
Reply-To: James A Morrison <ja2morri@student.math.uwaterloo.ca>, 107314@bugs.debian.org
Resent-From: James A Morrison <ja2morri@student.math.uwaterloo.ca>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: John O Sullivan <jos@debian.org>
Resent-Date: Wed, 01 Aug 2001 02:04:43 GMT
Resent-Message-ID: <handler.107314.B.9966308276707@bugs.debian.org>
Resent-Sender: owner@bugs.debian.org
X-Debian-PR-Message: report 107314
X-Debian-PR-Package: xfrisk
X-Debian-PR-Keywords:
X-Loop: owner@bugs.debian.org
Received: via spool by submit@bugs.debian.org id=B.9966308276707
(code B ref -1); Wed, 01 Aug 2001 02:04:43 GMT
From: James A Morrison <ja2morri@student.math.uwaterloo.ca>
Date: Tue, 31 Jul 2001 21:53:45 -0400 (EDT)
Message-Id: <200108010153.VAA13557@bacon.math.uwaterloo.ca>
To: submit@bugs.debian.org
Delivered-To: submit@bugs.debian.org
Package: xfrisk
Version: 1.2-1.1
Severity: important
xfrisk used MAXHOSTNAMELEN. This is not supported on GNU HURD because
there is no maximum. However, thanks to Neil Walfield, here is a patch
that alters xfrisk to use xgethostname() that allocates a buffer properly.
James Morrison
diff -Nur xfrisk-1.2/Makefile my_xfrisk/Makefile
--- xfrisk-1.2/Makefile Tue Jul 31 13:27:15 2001
+++ my_xfrisk/Makefile Tue Jul 31 13:16:42 2001
@@ -170,7 +170,7 @@
GAMEOBJS=client.o network.o gui.o callbacks.o utils.o dice.o cards.o \
game.o colormap.o help.o riskgame.o debug.o clientMain.o colorEdit.o \
registerPlayers.o addPlayer.o viewStats.o viewCards.o viewLog.o \
- viewChat.o viewFeedback.o
+ viewChat.o viewFeedback.o xgethostname.o
xfrisk: $(GAMEOBJS) $(COMPAT_OBJS)
$(CC) $(LDFLAGS) $^ $(XINC) $(XLIBS) $(LIBS) -o $@
@@ -207,7 +207,7 @@
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
# The computer player library
-libfriskAI.a: network.o aiDice.o game.o riskgame.o debug.o aiClientMain.o \
+libfriskAI.a: network.o aiDice.o game.o riskgame.o debug.o xgethostname.o aiClientMain.o \
aiController.o aiStubs.o $(COMPAT_OBJS)
$(AR) -cruv $@ $^
$(RANLIB) $@
diff -Nur xfrisk-1.2/aiClientMain.c my_xfrisk/aiClientMain.c
--- xfrisk-1.2/aiClientMain.c Sat Nov 27 13:19:33 1999
+++ my_xfrisk/aiClientMain.c Tue Jul 31 13:12:05 2001
@@ -45,6 +45,7 @@
#include "debug.h"
#include "aiClient.h"
#include "aiController.h"
+#include "xgethostname.h"
/* Private functions */
void AI_Start(Int32 argc, CString *argv);
@@ -133,7 +134,7 @@
{
struct sockaddr_in server;
struct hostent *hp;
- char strHostName[MAXHOSTNAMELEN + 1];
+ char *strHostName;
Int32 iMessageType, i;
void *pvMessage;
MsgRegisterClient msgRegisterClient;
@@ -181,7 +182,7 @@
* to each client. The server sends back the client ID.
*/
- gethostname(strHostName, sizeof(strHostName));
+ strHostName = xgethostname();
msgRegisterClient.strClientAddress =
(CString)MEM_Alloc(strlen(strHostName)+32);
snprintf(msgRegisterClient.strClientAddress, strlen(strHostName)+32,
Binary files xfrisk-1.2/aiColson and my_xfrisk/aiColson differ
Binary files xfrisk-1.2/aiConway and my_xfrisk/aiConway differ
Binary files xfrisk-1.2/aiDummy and my_xfrisk/aiDummy differ
diff -Nur xfrisk-1.2/client.c my_xfrisk/client.c
--- xfrisk-1.2/client.c Sun Jan 23 15:08:37 2000
+++ my_xfrisk/client.c Tue Jul 31 13:06:45 2001
@@ -59,6 +59,7 @@
#include "viewStats.h"
#include "addPlayer.h"
#include "language.h"
+#include "xgethostname.h"
/* Private data */
/** \struct _Client
@@ -99,7 +100,7 @@
{
struct sockaddr_in server;
struct hostent *hp;
- char strHostName[MAXHOSTNAMELEN + 1];
+ char *strHostName;
Int32 iCommLink, i;
Int32 iMessageType;
void *pvMessage;
@@ -146,7 +147,7 @@
* to each client. The server sends back the client ID.
*/
- gethostname(strHostName, sizeof(strHostName));
+ strHostName = xgethostname();
len = strlen(strHostName)+32;;
msgRegisterClient.strClientAddress = (CString)MEM_Alloc(len);
snprintf(msgRegisterClient.strClientAddress, len, "%s[%lu]",
diff -Nur xfrisk-1.2/xgethostname.c my_xfrisk/xgethostname.c
--- xfrisk-1.2/xgethostname.c Wed Dec 31 19:00:00 1969
+++ my_xfrisk/xgethostname.c Tue Jul 31 13:04:25 2001
@@ -0,0 +1,125 @@
+/* Copyright (c) 2001 Neal H Walfield <neal@cs.uml.edu>.
+
+ This file is placed into the public domain. Its distribution
+ is unlimited.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* NAME
+
+ xgethostname - get the host name.
+
+ SYNOPSIS
+
+ char *xgethostname (void);
+
+ DESCRIPTION
+
+ The xhostname function is intended to replace gethostname(2), a
+ function used to access the host name. The old interface is
+ inflexable given that it assumes the existance of the
+ MAXHOSTNAMELEN macro, which neither POSIX nor the proposed
+ Single Unix Specification version 3 guarantee to be defined.
+
+ RETURN VALUE
+
+ On success, a malloced, null terminated (possible truncated)
+ string containing the host name is returned. On failure,
+ NULL is returned and errno is set.
+ */
+
+#include <sys/param.h> /* For MAXHOSTNAMELEN */
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+char *
+xgethostname (void)
+{
+ char *buf;
+ int size = 0;
+ int err;
+#ifndef MAXHOSTNAMELEN
+ char *tmp;
+#endif
+
+#ifdef MAXHOSTNAMELEN
+ size = MAXHOSTNAMELEN;
+#else /* MAXHOSTNAMELEN */
+#ifdef _SC_HOST_NAME_MAX
+ size = sysconf (_SC_HOST_NAME_MAX);
+#else /* _SC_HOST_NAME_MAX */
+ if (size < 256)
+ size = 256;
+#endif /* MAXHOSTNAMELEN */
+#endif /* _SC_HOST_NAME_MAX */
+
+ buf = malloc (size);
+ if (! buf)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ err = gethostname (buf, size);
+#ifndef MAXHOSTNAMELEN
+ while (err == ENAMETOOLONG)
+ {
+ size *= 2;
+ tmp = realloc (buf, size);
+ if (! tmp)
+ {
+ if (buf)
+ free (buf);
+ errno = ENOMEM;
+ return NULL;
+ }
+ buf = tmp;
+
+ err = gethostname (buf, size);
+ }
+#endif
+ if (err)
+ {
+ if (buf)
+ free (buf);
+ errno = err;
+ return NULL;
+ }
+
+ return buf;
+}
+
+#ifdef WANT_TO_TEST_XGETHOSTNAME
+#include <stdio.h>
+#include <string.h>
+
+int
+main (int argc, char *argv[])
+{
+ char *hostname;
+
+ hostname = xgethostname ();
+ if (! hostname)
+ {
+ perror ("xgethostname");
+ return 1;
+ }
+
+ printf ("%s\n", hostname);
+ free (hostname);
+
+ return 0;
+}
+#endif /* WANT_TO_TEST_XGETHOSTNAME */
diff -Nur xfrisk-1.2/xgethostname.h my_xfrisk/xgethostname.h
--- xfrisk-1.2/xgethostname.h Wed Dec 31 19:00:00 1969
+++ my_xfrisk/xgethostname.h Tue Jul 31 13:04:25 2001
@@ -0,0 +1,48 @@
+/* Copyright (c) 2001 Neal H Walfield <neal@cs.uml.edu>.
+
+ This file is placed into the public domain. Its distribution
+ is unlimited.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* NAME
+
+ xgethostname - get the host name.
+
+ SYNOPSIS
+
+ char *xgethostname (void);
+
+ DESCRIPTION
+
+ The xhostname function is intended to replace gethostname(2), a
+ function used to access the host name. The old interface is
+ inflexable given that it assumes the existance of the
+ MAXHOSTNAMELEN macro, which neither POSIX nor the proposed
+ Single Unix Specification version 3 guarantee to be defined.
+
+ RETURN VALUE
+
+ On success, a malloced, null terminated (possible truncated)
+ string containing the host name is returned. On failure,
+ NULL is returned and errno is set.
+ */
+
+#ifndef XGETHOSTNAME
+#define XGETHOSTNAME
+
+char * xgethostname (void);
+
+#endif /* XGETHOSTNAME */
+
----- End forwarded message -----
--
Digital Electronic Being Intended for Assassination and Nullification
Reply to: