updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / slirp / fix17.patch
blob485d7b303df7e0fd9d5499afc648829098fc31a8
1 --- debug.c 2004-09-07 11:50:01.000000000 +1000
2 +++ debug.c 2005-11-01 10:45:27.865300800 +1100
3 @@ -98,7 +98,9 @@
4 ttyp->proto==PROTO_PPP?"PPP":
5 #endif
6 "SLIP"), buff);
7 +#ifndef FULL_BOLT
8 lprint(" %d baudrate\r\n", ttyp->baud);
9 +#endif
10 lprint(" interface is %s\r\n", ttyp->up?"up":"down");
11 lprint(" using fd %d, guardian pid is %d\r\n", ttyp->fd, ttyp->pid);
12 #ifndef FULL_BOLT
14 --- main.c 2004-09-07 12:25:39.000000000 +1000
15 +++ main.c 2005-11-27 22:13:00.651928000 +1100
16 @@ -602,10 +602,32 @@
17 keep it open.
19 Mainly for testing purposes, nice to be able to do fprintf(stderr...
21 + Includes Tim Watt's ttyname() fixes (modified)
26 int blnKeepErr, blnKeepStdOut;
27 + const char *ttyname_0_dup = 0;
28 + const char *ttyname_1_dup = 0;
29 + const char *ttyname_2_dup = 0;
31 +#define dup_ttyname(n) \
32 + if( (ttyname_##n##_dup = ttyname(n)) ) { \
33 + ttyname_##n##_dup = strdup(ttyname_##n##_dup); \
34 + }
36 +#define clr_ttyname(n) \
37 + if( (ttyname_##n##_dup) ) { \
38 + free((char *) ttyname_##n##_dup); \
39 + ttyname_##n##_dup = 0; \
40 + }
42 + dup_ttyname(0)
43 + dup_ttyname(1)
44 + dup_ttyname(2)
47 /* stderr going elsewhere ?? */
48 blnKeepErr = FALSE;
49 @@ -613,26 +635,32 @@
50 if(!isatty(2))
51 blnKeepErr = TRUE;
52 else {
53 - if((slirp_tty == NULL && strcmp(ttyname(0), ttyname(2)) == 0) ||
54 - (slirp_tty != NULL && strcmp(ttyname(2), slirp_tty) == 0) )
55 + if((slirp_tty == NULL && ttyname_0_dup && ttyname_2_dup && strcmp(ttyname_0_dup, ttyname_2_dup) == 0) ||
56 + (slirp_tty != NULL && ttyname_2_dup && strcmp(ttyname_2_dup, slirp_tty) == 0) )
57 blnKeepErr = FALSE;
58 else
59 blnKeepErr = TRUE;
63 /* stdout going elsewhere ?? */
64 blnKeepStdOut = FALSE;
65 if(!isatty(1))
66 blnKeepStdOut = TRUE;
67 else {
68 - if((slirp_tty == NULL && strcmp(ttyname(0), ttyname(1)) == 0) ||
69 - (slirp_tty != NULL && strcmp(ttyname(1), slirp_tty) == 0) )
70 + if((slirp_tty == NULL && ttyname_0_dup && ttyname_1_dup && strcmp(ttyname_0_dup, ttyname_1_dup) == 0) ||
71 + (slirp_tty != NULL && ttyname_1_dup && strcmp(ttyname_1_dup, slirp_tty) == 0) )
72 blnKeepStdOut = FALSE;
73 else
74 blnKeepStdOut = TRUE;
77 + clr_ttyname(0);
78 + clr_ttyname(1);
79 + clr_ttyname(2);
81 +#undef dup_ttyname
82 +#undef clr_ttyname
84 i = open("/dev/null", O_RDWR);
86 if(!blnKeepStdOut)
87 @@ -1068,7 +1096,7 @@
88 "1 Attached as unit %d, device %s\r\n\r\n[talking %s, %d baud]\r\n\r\nSLiRP Ready ...",
89 unit, device?device:"(socket)", buff2, ttyp->baud);
90 #else
91 - snprintf(buff, sizeof(buff)
92 + snprintf(buff, sizeof(buff),
93 "1 Attached as unit %d, device %s\r\n\r\n[talking %s]\r\n\r\nSLiRP Ready ...",
94 unit, device, buff2);
95 #endif
97 --- main.h 2004-09-01 17:36:45.000000000 +1000
98 +++ main.h 2005-11-01 11:03:21.288808000 +1100
99 @@ -5,6 +5,12 @@
100 * terms and conditions of the copyright.
103 +#define TRUE 1
104 +#define FALSE 0
106 +#include <sys/types.h>
107 +#include <unistd.h>
109 #ifdef HAVE_SYS_SELECT_H
110 #include <sys/select.h>
111 #endif
113 --- mbuf.c 2004-09-01 17:36:43.000000000 +1000
114 +++ mbuf.c 2006-01-08 12:00:20.843576000 +1100
115 @@ -146,18 +146,19 @@
116 struct mbuf *m;
117 int size;
119 + int datasize;
121 /* some compiles throw up on gotos. This one we can fake. */
122 if(m->m_size>size) return;
124 if (m->m_flags & M_EXT) {
125 - /* datasize = m->m_data - m->m_ext; */
126 + datasize = m->m_data - m->m_ext;
127 m->m_ext = (char *)realloc(m->m_ext,size);
128 /* if (m->m_ext == NULL)
129 * return (struct mbuf *)NULL;
131 - /* m->m_data = m->m_ext + datasize; */
132 + m->m_data = m->m_ext + datasize;
133 } else {
134 - int datasize;
135 char *dat;
136 datasize = m->m_data - m->m_dat;
137 dat = (char *)malloc(size);
139 --- version.h 2004-09-01 19:44:35.000000000 +1000
140 +++ version.h 2006-01-08 13:11:55.989692800 +1100
141 @@ -1,2 +1,2 @@
142 -#define SLIRP_VERSION "1.0.16"
143 +#define SLIRP_VERSION "1.0.17"
144 #define SLIRP_STATUS "BETA"