Package: dancer-ircd
Version: 1.0.36-8
Severity: important
Tags: patch
dancer-ircd fails to build on Hurd.
There is no PATH_MAX in Hurd, because Hurd doesn't impose path length
limitations.
if gcc -DHAVE_CONFIG_H -I. -I. -I../include -I../include -DPREFIX="\"/usr\""
-g3 -O2 -pedantic-errors -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual
-Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -W -Wno-unused -Wmissing-noreturn -Wundef -Wpacked
-Wnested-externs -Wbad-function-cast -Wunused-function -Wunused-label
-Wunused-value -Wunused-variable -Wredundant-decls -Wfloat-equal -std=gnu9x
-Werror -O2 -MT ircd.o -MD -MP -MF ".deps/ircd.Tpo" -c -o ircd.o ircd.c; \
then mv -f ".deps/ircd.Tpo" ".deps/ircd.Po"; else rm -f
".deps/ircd.Tpo"; exit 1; fi
In file included from ircd.c:36:
.../include/motd.h:35: error: 'PATH_MAX' undeclared here (not in a function)
make[2]: *** [ircd.o] Error 1
make[2]: Leaving directory `/root/packages/orig/dancer-ircd-1.0.36/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/packages/orig/dancer-ircd-1.0.36'
make: *** [src/dancer-ircd] Error 2
dpkg-buildpackage: failure: debian/rules build gave error exit status 2
Patch attached below to correct this.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)
Kernel: GNU-Mach 1.3.99/Hurd-0.3
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages dancer-ircd depends on:
ii adduser 3.107 add and remove users and groups
ii libc0.3 2.7-10 GNU C Library: Shared libraries
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
Versions of packages dancer-ircd recommends:
pn ntp <none> (no description available)
pn whois <none> (no description available)
-- no debconf information
--- orig/dancer-ircd-1.0.36/src/m_kline.c 2008-05-05 21:23:58.970000000 +0000
+++ dancer-ircd-1.0.36/src/m_kline.c 2008-05-05 22:44:27.190000000 +0000
@@ -133,21 +133,27 @@
LockedFile(const char *filename)
{
- char lockpath[PATH_MAX + 1];
+ static const char lock_suffix[] = ".lock";
char buffer[1024];
FBFILE *fileptr;
int killret;
+ size_t lockpath_len;
+ char* lockpath = NULL;
if (!filename)
return (0);
- ircsnprintf(lockpath, PATH_MAX + 1, "%s.lock", filename);
+ lockpath_len = strlen(filename) + strlen(lock_suffix) + 1;
+ lockpath = MyMalloc(lockpath_len);
+
+ ircsnprintf(lockpath, lockpath_len, "%s%s", filename, lock_suffix);
if ((fileptr = fbopen(lockpath, "r")) == (FBFILE *) NULL)
{
/*
* lockfile does not exist
*/
+ free(lockpath);
return (0);
}
@@ -164,6 +170,7 @@
if (killret == 0)
{
fbclose(fileptr);
+ free(lockpath);
return (1);
}
@@ -180,6 +187,7 @@
* Delete the outdated lock file
*/
unlink(lockpath);
+ free(lockpath);
return (0);
} /* LockedFile() */
--- orig/dancer-ircd-1.0.36/src/motd.c 2008-05-05 21:23:59.000000000 +0000
+++ dancer-ircd-1.0.36/src/motd.c 2008-05-05 21:43:47.660000000 +0000
@@ -92,14 +92,22 @@
*/
void InitMessageFile(MotdType motdType, const char *fileName, MessageFile *motd)
{
- strncpy_irc(motd->fileName, fileName, PATH_MAX);
- motd->fileName[PATH_MAX] = '\0';
+ motd->fileName = strdup(fileName);
motd->motdType = motdType;
motd->contentsOfFile = NULL;
motd->lastChangedDate[0] = '\0';
}
/*
+** FreeMessageFile
+**
+*/
+void FreeMessageFile(MessageFile* motd)
+ {
+ MyFree(motd->fileName);
+ }
+
+/*
** SendMessageFile
**
** This function split off so a server notice could be generated on a
--- orig/dancer-ircd-1.0.36/src/ircd.c 2008-05-05 21:23:59.930000000 +0000
+++ dancer-ircd-1.0.36/src/ircd.c 2008-05-05 21:43:47.500000000 +0000
@@ -598,6 +598,20 @@
}
/*
+ * cleanup_message_files
+ *
+ * inputs - none
+ * output - none
+ * side effects - Free allocated MessageFile memory.
+ */
+static void cleanup_message_files(void)
+ {
+ FreeMessageFile(&ConfigFileEntry.helpfile);
+ FreeMessageFile(&ConfigFileEntry.motd);
+ FreeMessageFile(&ConfigFileEntry.opermotd);
+ }
+
+/*
* initialize_message_files
*
* inputs - none
@@ -611,6 +625,8 @@
InitMessageFile( USER_MOTD, motd_file, &ConfigFileEntry.motd );
InitMessageFile( OPER_MOTD, oper_motd_file, &ConfigFileEntry.opermotd );
+ atexit(cleanup_message_files);
+
ReadMessageFile( &ConfigFileEntry.helpfile );
ReadMessageFile( &ConfigFileEntry.motd );
ReadMessageFile( &ConfigFileEntry.opermotd );
--- orig/dancer-ircd-1.0.36/include/motd.h 2008-05-05 21:24:05.120000000 +0000
+++ dancer-ircd-1.0.36/include/motd.h 2008-05-05 21:43:47.770000000 +0000
@@ -32,7 +32,7 @@
struct MessageFile
{
- char fileName[PATH_MAX + 1];
+ char* fileName;
MotdType motdType;
MessageFileLine* contentsOfFile;
char lastChangedDate[MAX_DATE_STRING + 1];
@@ -43,6 +43,7 @@
struct Client;
void InitMessageFile(MotdType, const char *, struct MessageFile *);
+void FreeMessageFile(MessageFile* motd);
int SendMessageFile(struct Client *, struct MessageFile *);
int ReadMessageFile(MessageFile *);
size_t count_message_file(MessageFile *);