From 5a94632e3102bdb60db0ce863e0e01a08d02e109 Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 26 May 2001 23:19:28 +0000 Subject: added a few syntactic corrections --- ulogd/conffile/conffile.c | 6 +++--- ulogd/include/ulogd/conffile.h | 4 ++-- ulogd/include/ulogd/ulogd.h | 6 +++--- ulogd/ulogd.c | 29 ++++++++++++++++------------- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/ulogd/conffile/conffile.c b/ulogd/conffile/conffile.c index 7185649..4257e3d 100644 --- a/ulogd/conffile/conffile.c +++ b/ulogd/conffile/conffile.c @@ -2,7 +2,7 @@ * * (C) 2000 by Harald Welte * - * $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 */ diff --git a/ulogd/include/ulogd/conffile.h b/ulogd/include/ulogd/conffile.h index ba16c35..b007004 100644 --- a/ulogd/include/ulogd/conffile.h +++ b/ulogd/include/ulogd/conffile.h @@ -2,7 +2,7 @@ * * (C) 2000 by Harald Welte * - * $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); diff --git a/ulogd/include/ulogd/ulogd.h b/ulogd/include/ulogd/ulogd.h index 9eb0052..36e6a8c 100644 --- a/ulogd/include/ulogd/ulogd.h +++ b/ulogd/include/ulogd/ulogd.h @@ -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 @@ -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/ulogd.c b/ulogd/ulogd.c index a091b6f..cb53a5e 100644 --- a/ulogd/ulogd.c +++ b/ulogd/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 @@ -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; } -- cgit v1.2.3