Files

146 lines
4.1 KiB
Diff

diff -u -r debug.c debug.c
--- debug.c 2004-09-07 11:50:01.000000000 +1000
+++ debug.c 2005-11-01 10:45:27.865300800 +1100
@@ -98,7 +98,9 @@
ttyp->proto==PROTO_PPP?"PPP":
#endif
"SLIP"), buff);
+#ifndef FULL_BOLT
lprint(" %d baudrate\r\n", ttyp->baud);
+#endif
lprint(" interface is %s\r\n", ttyp->up?"up":"down");
lprint(" using fd %d, guardian pid is %d\r\n", ttyp->fd, ttyp->pid);
#ifndef FULL_BOLT
diff -u -r main.c main.c
--- main.c 2004-09-07 12:25:39.000000000 +1000
+++ main.c 2005-11-27 22:13:00.651928000 +1100
@@ -602,10 +602,32 @@
keep it open.
Mainly for testing purposes, nice to be able to do fprintf(stderr...
+
+ Includes Tim Watt's ttyname() fixes (modified)
+
*/
{
int blnKeepErr, blnKeepStdOut;
+ const char *ttyname_0_dup = 0;
+ const char *ttyname_1_dup = 0;
+ const char *ttyname_2_dup = 0;
+
+#define dup_ttyname(n) \
+ if( (ttyname_##n##_dup = ttyname(n)) ) { \
+ ttyname_##n##_dup = strdup(ttyname_##n##_dup); \
+ }
+
+#define clr_ttyname(n) \
+ if( (ttyname_##n##_dup) ) { \
+ free((char *) ttyname_##n##_dup); \
+ ttyname_##n##_dup = 0; \
+ }
+
+ dup_ttyname(0)
+ dup_ttyname(1)
+ dup_ttyname(2)
+
/* stderr going elsewhere ?? */
blnKeepErr = FALSE;
@@ -613,26 +635,32 @@
if(!isatty(2))
blnKeepErr = TRUE;
else {
- if((slirp_tty == NULL && strcmp(ttyname(0), ttyname(2)) == 0) ||
- (slirp_tty != NULL && strcmp(ttyname(2), slirp_tty) == 0) )
+ if((slirp_tty == NULL && ttyname_0_dup && ttyname_2_dup && strcmp(ttyname_0_dup, ttyname_2_dup) == 0) ||
+ (slirp_tty != NULL && ttyname_2_dup && strcmp(ttyname_2_dup, slirp_tty) == 0) )
blnKeepErr = FALSE;
else
blnKeepErr = TRUE;
}
-
/* stdout going elsewhere ?? */
blnKeepStdOut = FALSE;
if(!isatty(1))
blnKeepStdOut = TRUE;
else {
- if((slirp_tty == NULL && strcmp(ttyname(0), ttyname(1)) == 0) ||
- (slirp_tty != NULL && strcmp(ttyname(1), slirp_tty) == 0) )
+ if((slirp_tty == NULL && ttyname_0_dup && ttyname_1_dup && strcmp(ttyname_0_dup, ttyname_1_dup) == 0) ||
+ (slirp_tty != NULL && ttyname_1_dup && strcmp(ttyname_1_dup, slirp_tty) == 0) )
blnKeepStdOut = FALSE;
else
blnKeepStdOut = TRUE;
}
+ clr_ttyname(0);
+ clr_ttyname(1);
+ clr_ttyname(2);
+
+#undef dup_ttyname
+#undef clr_ttyname
+
i = open("/dev/null", O_RDWR);
if(!blnKeepStdOut)
@@ -1068,7 +1096,7 @@
"1 Attached as unit %d, device %s\r\n\r\n[talking %s, %d baud]\r\n\r\nSLiRP Ready ...",
unit, device?device:"(socket)", buff2, ttyp->baud);
#else
- snprintf(buff, sizeof(buff)
+ snprintf(buff, sizeof(buff),
"1 Attached as unit %d, device %s\r\n\r\n[talking %s]\r\n\r\nSLiRP Ready ...",
unit, device, buff2);
#endif
diff -u -r main.h main.h
--- main.h 2004-09-01 17:36:45.000000000 +1000
+++ main.h 2005-11-01 11:03:21.288808000 +1100
@@ -5,6 +5,12 @@
* terms and conditions of the copyright.
*/
+#define TRUE 1
+#define FALSE 0
+
+#include <sys/types.h>
+#include <unistd.h>
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
diff -u -r mbuf.c mbuf.c
--- mbuf.c 2004-09-01 17:36:43.000000000 +1000
+++ mbuf.c 2006-01-08 12:00:20.843576000 +1100
@@ -146,18 +146,19 @@
struct mbuf *m;
int size;
{
+ int datasize;
+
/* some compiles throw up on gotos. This one we can fake. */
if(m->m_size>size) return;
if (m->m_flags & M_EXT) {
- /* datasize = m->m_data - m->m_ext; */
+ datasize = m->m_data - m->m_ext;
m->m_ext = (char *)realloc(m->m_ext,size);
/* if (m->m_ext == NULL)
* return (struct mbuf *)NULL;
*/
- /* m->m_data = m->m_ext + datasize; */
+ m->m_data = m->m_ext + datasize;
} else {
- int datasize;
char *dat;
datasize = m->m_data - m->m_dat;
dat = (char *)malloc(size);
diff -u -r version.h version.h
--- version.h 2004-09-01 19:44:35.000000000 +1000
+++ version.h 2006-01-08 13:11:55.989692800 +1100
@@ -1,2 +1,2 @@
-#define SLIRP_VERSION "1.0.16"
+#define SLIRP_VERSION "1.0.17"
#define SLIRP_STATUS "BETA"