chiark
/
gitweb
/
~mdw
/
fwd
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fwd: Improve `source' and `target' lifecycle management.
[fwd]
/
fwd.c
diff --git
a/fwd.c
b/fwd.c
index b621f450d099858ac7167578bb32557a6a28beb2..9d170e1bd2a988c65de16bed447988be6a5c1f4c 100644
(file)
--- a/
fwd.c
+++ b/
fwd.c
@@
-29,6
+29,7
@@
/*----- Global variables --------------------------------------------------*/
sel_state *sel; /* Multiplexor for nonblocking I/O */
/*----- Global variables --------------------------------------------------*/
sel_state *sel; /* Multiplexor for nonblocking I/O */
+unsigned flags = 0; /* Global state flags */
/*----- Static variables --------------------------------------------------*/
/*----- Static variables --------------------------------------------------*/
@@
-37,14
+38,9
@@
typedef struct conffile {
char *name;
} conffile;
char *name;
} conffile;
-static unsigned flags = 0; /* Global state flags */
static unsigned active = 0; /* Number of active things */
static conffile *conffiles = 0; /* List of configuration files */
static unsigned active = 0; /* Number of active things */
static conffile *conffiles = 0; /* List of configuration files */
-#define FW_SYSLOG 1u
-#define FW_QUIET 2u
-#define FW_SET 4u
-
/*----- Configuration parsing ---------------------------------------------*/
/* --- @parse@ --- *
/*----- Configuration parsing ---------------------------------------------*/
/* --- @parse@ --- *
@@
-156,6
+152,7
@@
void parse(scanner *sc)
s->ops->attach(s, sc, t);
if (t->ops->confirm)
t->ops->confirm(t);
s->ops->attach(s, sc, t);
if (t->ops->confirm)
t->ops->confirm(t);
+ source_dec(s); target_dec(t);
}
/* --- Include configuration from a file --- *
}
/* --- Include configuration from a file --- *
@@
-245,7
+242,7
@@
void fw_log(time_t t, const char *fmt, ...)
t = time(0);
tm = localtime(&t);
DENSURE(&d, 64);
t = time(0);
tm = localtime(&t);
DENSURE(&d, 64);
- d.len += strftime(d.buf, d.sz, "%Y-%m-%d %H:%M:%S ", tm);
+ d.len += strftime(d.buf, d.sz, "%Y-%m-%d %H:%M:%S
%z
", tm);
va_start(ap, fmt);
dstr_vputf(&d, fmt, &ap);
va_end(ap);
va_start(ap, fmt);
dstr_vputf(&d, fmt, &ap);
va_end(ap);