ossp-pkg/l2/l2_ch_buffer.c 1.8 -> 1.9
--- l2_ch_buffer.c 2001/08/24 15:16:43 1.8
+++ l2_ch_buffer.c 2001/09/02 15:37:48 1.9
@@ -63,7 +63,7 @@
static int hook_configure(l2_context_t *ctx, const char *fmt, va_list ap)
{
l2_ch_buffer_t *cfg;
- l2_param_t pa[3];
+ l2_param_t pa[3];
l2_result_t rv;
/* parameter checks */
@@ -152,15 +152,23 @@
{
l2_ch_buffer_t *cfg;
+ /* parameter checks */
+ if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
+ return L2_ERROR;
+
+ /* write stale data before closing down */
+ if (cfg->bufpos > 0) {
+ if (downstream != NULL)
+ if (l2_channel_write(downstream, cfg->buf, cfg->bufpos) == L2_ERROR)
+ return L2_ERROR;
+ cfg->bufpos = 0;
+ }
+
/* optionally close downstream channel, too */
if (downstream != NULL)
if (l2_channel_close(downstream) == L2_ERROR)
return L2_ERROR;
- /* parameter checks */
- if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
- return L2_ERROR;
-
/* close channel buffer */
if (cfg->buf != NULL) {
free(cfg->buf);
|
|