[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] 2.1.17 portability and core dump fixes
From: |
Joe Buehler |
Subject: |
[PATCH] 2.1.17 portability and core dump fixes |
Date: |
Wed, 14 Dec 2005 07:41:08 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
Here are some patches to make 2.1.17 compile and run properly
under various non-linux UNIX's (Solaris, HPUX, AIX). There
are also a couple fixes for core dumps that happen under AIX.
The maintainer(s) might do a grep for double semicolons (;;)
in various places they don't need to be and get rid of them;
there are a fair number and they cause compiler warnings.
One place was considered an error by one of the compilers and
is removed in the attached patch.
You might also try valgrind on the code -- cfagent has a number
of memory leaks. They sort of don't matter because the program is
not a daemon, but still...
In order:
acl.c
- prototype fix so it compiles
cf.defs.h
- elimination of illegal (in newer C standards) comma
cf.extern.h
- elimination of extraneous semicolon
cfagent.c
- null pointer deref fix
cfetool.c
- illegal use of computed value for array size
- missing argument in printf() call
cfservd.c
- use of C++ comment syntax in C code
edittools.c
- use of == where = was intended (uninitialized variable)
- illegal use of CURRENTITEM (it points to freed memory -- found
via insure++)
ifconf.c
- INET_ADDRSTRLEN appears to be a linuxism
--
Joe Buehler
--- ./src/acl.c.~1~ 2005-02-08 06:50:01.000000000 -0500
+++ ./src/acl.c 2005-12-13 14:08:05.000000000 -0500
@@ -1692,11 +1692,11 @@
/*****************************************************************************/
-int CheckNTACE(aces,method,filename,action)
-struct CFACE *aces; /* List built up during parsing of config file */
-char method; /* ACL operation method (o/a) */
-char *filename; /* The filename */
-enum fileactions action;/* The action to be performed */
+int CheckNTACE(
+ struct CFACE *aces, /* List built up during parsing of config file
*/
+ char method, /* ACL operation method (o/a) */
+ char *filename, /* The filename */
+ enum fileactions action)/* The action to be performed */
{
#ifdef NT
struct CFACE *ep;
@@ -1718,12 +1718,12 @@
/*************************** END NT Addition *******************************/
-int CheckPosixACE(aces,method,filename,action)
-struct CFACE *aces;
-char method;
-char *filename;
-enum fileactions action;
+int CheckPosixACE(
+ struct CFACE *aces,
+ char method,
+ char *filename,
+ enum fileactions action)
{
#if defined(HAVE_SYS_ACL_H) && defined(SOLARIS)
struct CFACE *ep;
--- ./src/cf.defs.h.~1~ 2005-10-09 11:53:26.000000000 -0400
+++ ./src/cf.defs.h 2005-12-13 14:08:05.000000000 -0500
@@ -1127,8 +1127,8 @@
cfsys,
cfpipe,
cfalrm,
- cfterm,
+ cfterm
};
#define highest_signal 64
--- ./src/cf.extern.h.~1~ 2005-09-09 01:49:53.000000000 -0400
+++ ./src/cf.extern.h 2005-12-13 14:08:05.000000000 -0500
@@ -45,8 +45,8 @@
extern int GOTMETHODARGS;
extern struct Item *QUERYVARS;
-extern struct Item *METHODRETURNVARS;;
+extern struct Item *METHODRETURNVARS;
extern struct Item *METHODRETURNCLASSES;
extern char METHODFILENAME[CF_BUFSIZE];
extern char *VMETHODPROTO[];
--- ./src/cfagent.c.~1~ 2005-10-17 03:39:03.000000000 -0400
+++ ./src/cfagent.c 2005-12-13 15:05:52.000000000 -0500
@@ -1393,8 +1393,8 @@
if (IsDefinedClass(ep->classes))
{
something_to_do = true;
- Verbose("Defined Edit %s / %s\n",ep->data,ep->classes);
+ Verbose("Defined Edit %s /
%s\n",ep->data?ep->data:"(null)",ep->classes);
break;
}
}
--- ./src/cfetool.c.~1~ 2005-10-09 07:39:22.000000000 -0400
+++ ./src/cfetool.c 2005-12-13 14:08:05.000000000 -0500
@@ -839,7 +839,7 @@
time_t timestamp;
char filename[CF_BUFSIZE];
int cwdbufsize = CF_BUFSIZE - strlen(PATHNAME) - strlen(NAME);
- char current_dir[cwdbufsize];
+ char current_dir[CF_BUFSIZE];
AGE = WAGE = 0;
ITER = 0;
@@ -1255,8 +1255,8 @@
break;
}
- Verbose("Dumping database: %s\n");
+ Verbose("Dumping database: %s\n", AVDB);
if(OpenDatabase(false) != 0)
exit(1);
--- ./src/cfservd.c.~1~ 2005-10-18 14:59:16.000000000 -0400
+++ ./src/cfservd.c 2005-12-13 14:08:05.000000000 -0500
@@ -604,11 +604,11 @@
FD_ZERO(&rset);
FD_SET(sd,&rset);
- timeout.tv_sec = 5; // Set a 5 second timeout for select
+ timeout.tv_sec = 5; /* Set a 5 second timeout for select */
timeout.tv_usec = 0;
ret_val = select((sd+1),&rset,NULL,NULL,&timeout);
- if (ret_val == -1) // Error received from call to select
+ if (ret_val == -1) /* Error received from call to select */
{
if (errno == EINTR)
{
@@ -620,8 +620,8 @@
exit(1);
}
}
- else if (!ret_val) // No data waiting, we must have timed out!
+ else if (!ret_val) /* No data waiting, we must have timed out! */
{
continue;
}
--- ./src/edittools.c.~1~ 2005-10-09 11:53:26.000000000 -0400
+++ ./src/edittools.c 2005-12-13 15:02:28.000000000 -0500
@@ -759,7 +759,7 @@
if (CURRENTLINEPTR == NULL)
{
- newlineptr == NULL;
+ newlineptr = NULL;
}
else
{
@@ -1470,12 +1470,13 @@
while (!feof(pp))
{
- ReadLine(CURRENTITEM,CF_BUFSIZE,pp);
+ char buffer[CF_BUFSIZE];
+ ReadLine(buffer,CF_BUFSIZE,pp);
if (!feof(pp))
{
- EditVerbose("%s\n",CURRENTITEM);
+ EditVerbose("%s\n",buffer);
}
}
--- ./src/ifconf.c.~1~ 2005-10-09 16:21:13.000000000 -0400
+++ ./src/ifconf.c 2005-12-13 14:08:05.000000000 -0500
@@ -68,6 +68,10 @@
#include "cf.defs.h"
#include "cf.extern.h"
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN sizeof("255.255.255.255")
+#endif
+
#if !defined(NT) && !defined(IRIX)
/* IRIX makes the routing stuff obsolete unless we do this */
- [PATCH] 2.1.17 portability and core dump fixes,
Joe Buehler <=