]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
added a few syntactic corrections
authorlaforge <laforge>
Sat, 26 May 2001 23:19:28 +0000 (23:19 +0000)
committerlaforge <laforge>
Sat, 26 May 2001 23:19:28 +0000 (23:19 +0000)
conffile/conffile.c
include/ulogd/conffile.h
include/ulogd/ulogd.h
ulogd.c

index 718564967999ae7ce855f88f8ea4f36c83852a95..4257e3d5bff66d4622e37817a91da554c421c1cd 100644 (file)
@@ -2,7 +2,7 @@
  *
  * (C) 2000 by Harald Welte <laforge@gnumonks.org>
  *
- * $Id: conffile.c,v 1.1 2000/11/20 11:43:22 laforge Exp $
+ * $Id: conffile.c,v 1.2 2001/02/04 13:08:02 laforge Exp $
  * 
  * This code is distributed under the terms of GNU GPL */
 
@@ -33,7 +33,7 @@ static char *fname = NULL;
  * Return value:       pointer to first char after word
  * This function can deal with "" quotes 
  */
-char* get_word(char *line, char *not, char *buf)
+static char *get_word(char *line, char *not, char *buf)
 {
        char *p, *start = NULL, *stop = NULL;
        int inquote = 0;
@@ -69,7 +69,7 @@ char* get_word(char *line, char *not, char *buf)
        if (!stop)
                return NULL;
 
-       strncpy(buf, start, stop-start);
+       strncpy(buf, start, (size_t) (stop-start));
        *(buf + (stop-start)) = '\0';
 
        /* skip quote character */
index ba16c350d70495ef69363f8553cff2044599828a..b007004b3fa219568b26b210a85e1656533e028f 100644 (file)
@@ -2,7 +2,7 @@
  *
  * (C) 2000 by Harald Welte <laforge@gnumonks.org>
  *
- * $Id: conffile.h,v 1.5 2000/09/12 14:29:37 laforge Exp $
+ * $Id: conffile.h,v 1.1 2000/11/20 11:43:22 laforge Exp $
  * 
  * This code is distributed under the terms of GNU GPL */
 
@@ -54,7 +54,7 @@ typedef struct config_entry {
 } config_entry_t;
 
 /* if an error occurs, config_errce is set to the erroneous ce */
-config_entry_t *config_errce;
+extern config_entry_t *config_errce;
 
 /* tell us the name of the config file */
 int config_register_file(const char *file);
index 9eb0052e90856bc1157d2572000e3085c9f76784..36e6a8c3dfc730d319b60d5c19b83e35c1a83ea3 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _ULOGD_H
 #define _ULOGD_H
-/* ulogd, Version $Revision: 1.11 $
+/* ulogd, Version $Revision: 1.12 $
  *
  * userspace logging daemon for netfilter ULOG target
  * of the linux 2.4 netfilter subsystem.
@@ -9,7 +9,7 @@
  *
  * this code is released under the terms of GNU GPL
  *
- * $Id: ulogd.h,v 1.11 2001/02/04 10:15:19 laforge Exp $
+ * $Id: ulogd.h,v 1.12 2001/02/04 13:07:22 laforge Exp $
  */
 
 #include <libipulog/libipulog.h>
@@ -148,7 +148,7 @@ unsigned int keyh_getid(const char *name);
 ulog_iret_t *keyh_getres(unsigned int id);
 
 /* the key hash itself */
-struct ulogd_keyh_entry *ulogd_keyh;
+extern struct ulogd_keyh_entry *ulogd_keyh;
 
 #define IS_VALID(x)    (x.flags & ULOGD_RETF_VALID)
 
diff --git a/ulogd.c b/ulogd.c
index a091b6f2f7dd2d3a35e5309ba1bed91c76a4d167..cb53a5e6c124f3ac49ebf643dc3312018e0c5956 100644 (file)
--- a/ulogd.c
+++ b/ulogd.c
@@ -1,4 +1,4 @@
-/* ulogd, Version $Revision: 1.14 $
+/* ulogd, Version $Revision: 1.15 $
  *
  * userspace logging daemon for the netfilter ULOG target
  * of the linux 2.4 netfilter subsystem.
@@ -7,7 +7,7 @@
  *
  * this code is released under the terms of GNU GPL
  *
- * $Id: ulogd.c,v 1.14 2001/01/29 11:45:22 laforge Exp $
+ * $Id: ulogd.c,v 1.15 2001/02/04 10:15:19 laforge Exp $
  */
 
 #include <stdio.h>
@@ -112,7 +112,7 @@ static unsigned int interh_allocid(ulog_interpreter_t *ip)
 /* get interpreter id by name */
 unsigned int interh_getid(const char *name)
 {
-       int i;
+       unsigned int i;
        for (i = 1; i <= ulogd_interh_ids; i++)
                if (!strcmp(name, (ulogd_interh[i])->name))
                        return i;
@@ -123,7 +123,7 @@ unsigned int interh_getid(const char *name)
 /* dump out the contents of the interpreter hash */
 static void interh_dump(void)
 {
-       int i;
+       unsigned int i;
 
        for (i = 1; i <= ulogd_interh_ids; i++)
                ulogd_log(ULOGD_DEBUG, "ulogd_interh[%d] = %s\n", 
@@ -185,18 +185,18 @@ static unsigned int keyh_allocid(ulog_interpreter_t *ip, unsigned int offset,
 /* dump the keyhash to standard output */
 static void keyh_dump(void)
 {
-       int i;
+       unsigned int i;
 
        printf("dumping keyh\n");
        for (i = 1; i <= ulogd_keyh_ids; i++)
-               printf("ulogd_keyh[%d] = %s:%d\n", i, ulogd_keyh[i].interp->name
-                               ulogd_keyh[i].offset);
+               printf("ulogd_keyh[%lu] = %s:%u\n", i
+                       ulogd_keyh[i].interp->name, ulogd_keyh[i].offset);
 }
 
 /* get keyid by name */
 unsigned int keyh_getid(const char *name)
 {
-       int i;
+       unsigned int i;
        for (i = 1; i <= ulogd_keyh_ids; i++)
                if (!strcmp(name, ulogd_keyh[i].name))
                        return i;
@@ -239,7 +239,7 @@ ulog_iret_t *keyh_getres(unsigned int id)
 /* try to lookup a registered interpreter for a given name */
 static ulog_interpreter_t *find_interpreter(const char *name)
 {
-       int id;
+       unsigned int id;
        
        id = interh_getid(name);
        if (!id)
@@ -252,7 +252,7 @@ static ulog_interpreter_t *find_interpreter(const char *name)
  * target. */ 
 void register_interpreter(ulog_interpreter_t *me)
 {
-       int i;
+       unsigned int i;
 
        /* check if we already have an interpreter with this name */
        if (find_interpreter(me->name)) {
@@ -285,7 +285,8 @@ void register_interpreter(ulog_interpreter_t *me)
 
        /* all work done, we can prepend the new interpreter to the list */
        if (ulogd_interpreters)
-               me->result[me->key_num - 1].next = &ulogd_interpreters->result[0];
+               me->result[me->key_num - 1].next = 
+                                       &ulogd_interpreters->result[0];
        me->next = ulogd_interpreters;
        ulogd_interpreters = me;
 }
@@ -313,7 +314,7 @@ void register_output(ulog_output_t *me)
        if (find_output(me->name)) {
                ulogd_log(ULOGD_NOTICE, "output `%s' already registered\n",
                                me->name);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        ulogd_log(ULOGD_NOTICE, "registering output `%s'\n", me->name);
        me->next = ulogd_outputs;
@@ -371,8 +372,10 @@ static void clean_results(ulog_iret_t *ret)
        ulog_iret_t *r;
 
        for (r = ret; r; r = r->next) {
-               if (r->flags & ULOGD_RETF_FREE)
+               if (r->flags & ULOGD_RETF_FREE) {
                        free(r->value.ptr);
+                       r->value.ptr = NULL;
+               }
                memset(&r->value, 0, sizeof(r->value));
                r->flags &= ~ULOGD_RETF_VALID;
        }