bug-httptunnel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for httptunnel 3.3 -s to handle stdout properly


From: Szabó Péter
Subject: patch for httptunnel 3.3 -s to handle stdout properly
Date: Mon, 27 Nov 2006 12:16:42 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060101

Dear Developers,

I think there is a typo in common.c which prevents -s from working
properly. The patch attached fixes the problem. I have tested
with

  ssh -O "ProxyCommand=strace -s9999999 -eread,write -o/tmp/rw htc -s 
myserver1:2222" myserver2

The unpatched htc doesn't work (tries write(0, "...", ...)= -1, errno=EBADF),
the patched htc woiks (tries write(1, "...", ...)).

Best regards,

Péter Szabó
free software consultant
Free Software Institute, Hungary
--- httptunnel-3.3/common.c.orig        2006-11-27 12:11:06.000000000 +0100
+++ httptunnel-3.3/common.c     2006-11-27 12:08:46.000000000 +0100
@@ -307,21 +307,21 @@
        }
 
 #ifdef DEBUG_MODE
       log_annoying ("read %d bytes from tunnel:", n);
       if (debug_level >= 5)
        dump_buf (debug_file, buf, (size_t)n);
 #endif
 
       /* If fd == 0, then we are using --stdin-stdout so write to stdout,
        * not fd. */
-      m = write_all (fd ? fd : 0, buf, (size_t)n);
+      m = write_all (fd ? fd : 1, buf, (size_t)n);
       log_annoying ("write_all (%d, %p, %d) = %d", fd ? fd : 1, buf, n, m);
       return m;
     }
   else if (events & POLLHUP)
     log_error ("handle_device_input: POLLHUP");
   else if (events & POLLERR)
     log_error ("handle_device_input: PULLERR");
   else if (events & POLLNVAL)
     log_error ("handle_device_input: PULLINVAL");
   else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]