OSSP CVS Repository

ossp - Check-in [1040]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1040
Date: 2001-Sep-26 16:31:22 (local)
2001-Sep-26 14:31:22 (UTC)
User:rse
Branch:
Comment: Cleanup: always use the channel API and 1:1 pass through errors.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ch_pipe.c      1.19 -> 1.20     5 inserted, 7 deleted

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 */

CVSTrac 2.0.1