ossp-pkg/l2/l2_ch_pipe.c 1.19 -> 1.20
--- l2_ch_pipe.c 2001/09/26 14:29:03 1.19
+++ l2_ch_pipe.c 2001/09/26 14:31:22 1.20
@@ -39,9 +39,6 @@
#define L2_PIPE_WRITEFAIL 6 /* how long before real failure is indicated */
#define L2_PIPE_MAXARGS 256 /* how many args can our piped command have */
-static l2_result_t hook_close(l2_context_t *, l2_channel_t *); /* prototypes */
-
-
/* declare private channel configuration */
typedef struct {
pid_t Pid; /* process id of child command */
@@ -226,14 +223,15 @@
l2_level_t level, const char *buf, size_t buf_size)
{
l2_ch_pipe_t *cfg = (l2_ch_pipe_t *)ctx->vp;
+ l2_result_t rv;
/* write message to channel pipe */
if (write(cfg->piFd[1], buf, buf_size) == -1) {
if ((errno == EPIPE) && (cfg->iWritefail++ < L2_PIPE_WRITEFAIL)) {
- if (hook_close(ctx, ch) != L2_OK)
- return L2_ERR_SYS;
- if (hook_open(ctx, ch) != L2_OK)
- return L2_ERR_SYS;
+ if ((rv = l2_channel_close(ch)) != L2_OK)
+ return rv;
+ if ((rv = l2_channel_open(ch)) != L2_OK)
+ return rv;
return hook_write(ctx, ch, level, buf, buf_size);
}
else { /* not broken pipe problem or over the fail limit */
|
|