fwd.c (fw_log): Report the timezone in log messages.
[fwd] / chan.c
diff --git a/chan.c b/chan.c
index ac4cf3e..5fbecb1 100644 (file)
--- a/chan.c
+++ b/chan.c
@@ -5,45 +5,26 @@
  * (c) 1999 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
- * This file is part of the `fw' port forwarder.
+ * This file is part of the `fwd' port forwarder.
  *
- * `fw' is free software; you can redistribute it and/or modify
+ * `fwd' is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
- * `fw' is distributed in the hope that it will be useful,
+ *
+ * `fwd' is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
- * along with `fw'; if not, write to the Free Software Foundation,
+ * along with `fwd'; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/*----- Header files ------------------------------------------------------*/
-
-#include "config.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/uio.h>
-
-#include <mLib/alloc.h>
-#include <mLib/conn.h>
-#include <mLib/sel.h>
-
-#include "chan.h"
-#include "fw.h"
+#include "fwd.h"
 
 #ifdef CHAN_DEBUG
 #  define D(x) x
@@ -99,9 +80,9 @@ static void writechan(int fd, unsigned mode, void *vp)
     if (w < 0) {
       if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
        return;
+      c->err = errno;
       goto close;
-    }
-    else if (w == 0)
+    } else if (w == 0)
       goto close;
     else if (c->len == CHAN_BUFSZ && !(c->f & CHANF_CLOSE))
       sel_addfile(&c->r);
@@ -172,9 +153,9 @@ static void readchan(int fd, unsigned mode, void *vp)
   if (r < 0) {
     if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
       return;
+    c->err = errno;
     goto close;
-  }
-  else if (r == 0)
+  } else if (r == 0)
     goto close;
   else if (c->len == 0 && (c->f & CHANF_READY)) {
     sel_addfile(&c->w);