--- l2_ch_prefix.c 2001/10/09 15:34:55 1.15
+++ l2_ch_prefix.c 2001/11/03 22:51:36 1.16
@@ -134,7 +134,7 @@
l2_level_t level, const char *buf, size_t buf_size)
{
l2_ch_prefix_t *cfg = (l2_ch_prefix_t *)ctx->vp;
- l2_channel_t *downstream = l2_channel_downstream(ch);
+ l2_channel_t *downstream;
time_t t;
struct tm *tm;
size_t n;
@@ -158,23 +158,19 @@
return L2_ERR_ARG;
if ((n = strftime(buf2, sizeof(buf2), buf1, tm)) == 0)
return L2_ERR_SYS;
- if ((rv = l2_channel_write(downstream, level, buf2, n)) != L2_OK)
- return rv;
+ downstream = NULL;
+ while ((rv = l2_channel_downstream(ch, &downstream)) == L2_OK)
+ if ((rv = l2_channel_write(downstream, level, buf2, n)) != L2_OK)
+ return rv;
}
- /* write to downstream channel */
- if ((rv = l2_channel_write(downstream, level, buf, buf_size)) != L2_OK)
- return rv;
-
- return L2_OK;
+ return L2_OK_PASS;
}
/* destroy channel */
static l2_result_t hook_destroy(l2_context_t *ctx, l2_channel_t *ch)
{
l2_ch_prefix_t *cfg = (l2_ch_prefix_t *)ctx->vp;
- l2_channel_t *downstream = l2_channel_downstream(ch);
- l2_result_t rv;
/* free prefix structure */
if (cfg->prefix != NULL)
@@ -183,11 +179,7 @@
free(cfg->timezone);
free(cfg);
- /* optionally destroy downstream channel, too */
- if ((rv = l2_channel_destroy(downstream)) != L2_OK)
- return rv;
-
- return L2_OK;
+ return L2_OK_PASS;
}
/* exported channel handler structure */
|