]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
General code cleanup by Roberto Nibali:
authorlaforge <laforge>
Mon, 9 Dec 2002 15:03:51 +0000 (15:03 +0000)
committerlaforge <laforge>
Mon, 9 Dec 2002 15:03:51 +0000 (15:03 +0000)
- linking for dlopen() needs to be after the object generation
- fix small typo in Rules.make.in
- #ifdef DEBUG all functions that are not used
- add missing #include's
- fix sloppy braceing
- added return for 'int main()'

Makefile.in
Rules.make.in
extensions/ulogd_LOCAL.c
extensions/ulogd_LOGEMU.c
ulogd.c

index a7d01e1a94b84d360800d7995639c47f111f8ae5..52bede7d2f9c0b05ad381de1f0d665555f41c8b4 100644 (file)
@@ -32,7 +32,7 @@ recurse:
        @for d in $(SUBDIRS); do if ! make -C $$d; then exit 1; fi; done
 
 ulogd: ulogd.c $(LIBIPULOG) ulogd.h conffile/conffile.o $(LIBIPULOG)/libipulog.a
-       $(CC) $(CFLAGS) -rdynamic $(LIBS) $< conffile/conffile.o $(LIBIPULOG)/libipulog.a -o $@
+       $(CC) $(CFLAGS) -rdynamic $< conffile/conffile.o $(LIBIPULOG)/libipulog.a -o $@ $(LIBS)
 
 clean:
 #      rm -f ulogd *.o extensions/*.o extensions/*.so conffile/*.o
index e5339f3e249e8939e63a27012752b690403572c9..468df72220429aa445141ab6ef7565177e239ec6 100644 (file)
@@ -17,7 +17,7 @@ INCCONFFILE=-I@top_srcdir@/conffile
 CC=@CC@
 CFLAGS=@CFLAGS@ @CPPFLAGS@ 
 CFLAGS+=-DULOGD_CONFIGFILE=\"$(ULOGD_CONFIGFILE)\"
-# doesn't wor for subdirs
+# doesn't work for subdirs
 #CFLAGS+=$(INCIPULOG) $(INCCONFFILE)
 CFLAGS+=-I/usr/src/linux/include
 #CFLAGS+=@DEFS@
index e396cf526d41419716540a54113e69ea39d6073d..f6078c469230f82effdfa0f0e174db0d2d551d08 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/time.h>
 #include <ulogd/ulogd.h>
 
 #ifdef DEBUG_LOCAL
index c31708f8c2d3a8341f762893aff476d677f7fc97..24f61d9e9a2dccbdc8341c11c7c2403823502a89 100644 (file)
@@ -1,4 +1,4 @@
-/* ulogd_LOGEMU.c, Version $Revision: 1.9 $
+/* ulogd_LOGEMU.c, Version $Revision: 1.10 $
  *
  * ulogd output target for syslog logging emulation
  *
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd_LOGEMU.c,v 1.9 2002/04/27 19:45:51 laforge Exp $
+ * $Id: ulogd_LOGEMU.c,v 1.10 2002/12/09 14:42:43 laforge Exp $
  *
  */
 
@@ -30,6 +30,9 @@
 #include <string.h>
 #include <time.h>
 #include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>
 #include <ulogd/ulogd.h>
@@ -119,11 +122,11 @@ int _output_logemu(ulog_iret_t *res)
        timestr = ctime(&now) + 4;
 
        /* truncate time */
-       if (tmp = strchr(timestr, '\n'))
+       if ((tmp = strchr(timestr, '\n')))
                *tmp = '\0';
 
        /* truncate hostname */
-       if (tmp = strchr(hostname, '.'))
+       if ((tmp = strchr(hostname, '.')))
                *tmp = '\0';
 
        /* print time and hostname */
diff --git a/ulogd.c b/ulogd.c
index 201a88abcd2d181cc3f86b58b072edfdb6b4ea74..9d985f62563b75ac7cf88ad32b4e4d2b993f78e2 100644 (file)
--- a/ulogd.c
+++ b/ulogd.c
@@ -1,6 +1,6 @@
-/* ulogd, Version $Revision: 1.28 $
+/* ulogd, Version $Revision: 1.29 $
  *
- * $Id: ulogd.c,v 1.28 2002/07/30 07:23:36 laforge Exp $
+ * $Id: ulogd.c,v 1.29 2002/12/09 14:42:43 laforge Exp $
  *
  * userspace logging daemon for the netfilter ULOG target
  * of the linux 2.4 netfilter subsystem.
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ulogd.c,v 1.28 2002/07/30 07:23:36 laforge Exp $
+ * $Id: ulogd.c,v 1.29 2002/12/09 14:42:43 laforge Exp $
  *
  * Modifications:
  *     14 Jun 2001 Martin Josefsson <gandalf@wlug.westbo.se>
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include <time.h>
+#include <ctype.h>
 #include <signal.h>
 #include <dlfcn.h>
 #include <sys/types.h>
@@ -145,6 +146,7 @@ unsigned int interh_getid(const char *name)
        return 0;
 }
 
+#ifdef DEBUG
 /* dump out the contents of the interpreter hash */
 static void interh_dump(void)
 {
@@ -155,6 +157,7 @@ static void interh_dump(void)
                        i, (ulogd_interh[i])->name);
 
 }
+#endif
 
 /* key hash allocation granularity */
 #define KEYH_ALLOC_GRAN 20
@@ -207,6 +210,7 @@ static unsigned int keyh_allocid(ulog_interpreter_t *ip, unsigned int offset,
        return id;
 }
 
+#ifdef DEBUG
 /* dump the keyhash to standard output */
 static void keyh_dump(void)
 {
@@ -217,6 +221,7 @@ static void keyh_dump(void)
                printf("ulogd_keyh[%lu] = %s:%u\n", i, 
                        ulogd_keyh[i].interp->name, ulogd_keyh[i].offset);
 }
+#endif
 
 /* get keyid by name */
 unsigned int keyh_getid(const char *name)
@@ -670,8 +675,8 @@ int main(int argc, char* argv[])
 
        /* endless loop receiving packets and handling them over to
         * handle_packet */
-       while (len = ipulog_read(libulog_h, libulog_buf, 
-                                bufsiz_ce.u.value, 1)) {
+       while ((len = ipulog_read(libulog_h, libulog_buf, 
+                                bufsiz_ce.u.value, 1))) {
 
                if (len <= 0) {
                        /* this is not supposed to happen */
@@ -679,8 +684,8 @@ int main(int argc, char* argv[])
                                  "ipulog_errno == %d, errno = %d\n",
                                  len, ipulog_errno, errno);
                } else {
-                       while (upkt = ipulog_get_packet(libulog_h,
-                                              libulog_buf, len)) {
+                       while ((upkt = ipulog_get_packet(libulog_h,
+                                              libulog_buf, len))) {
                                DEBUGP("==> packet received\n");
                                handle_packet(upkt);
                        }
@@ -689,4 +694,5 @@ int main(int argc, char* argv[])
 
        /* hackish, but result is the same */
        sigterm_handler(SIGTERM);       
+       return(0);
 }