Zero out some more key data before freeing it
[tor/rransom.git] / Win32Build / mingw / libevent-1.1b-mingw.diff
blobc7cea5b3262f69bc07073608ff8563b519492364
1 === Makefile.am
2 ==================================================================
3 --- Makefile.am (revision 8794)
4 +++ Makefile.am (local)
5 @@ -1,6 +1,5 @@
6 AUTOMAKE_OPTIONS = foreign no-dependencies
8 -SUBDIRS = . sample test
10 EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
11 kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \
12 @@ -20,13 +19,29 @@
14 lib_LTLIBRARIES = libevent.la
16 -libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c
17 -libevent_la_LIBADD = @LTLIBOBJS@
18 +if BUILD_WIN32
20 +SUBDIRS = . sample
21 +SYS_LIBS = -lws2_32
22 +SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c
23 +SYS_INCLUDES = -IWIN32-Code
25 +else
27 +SUBDIRS = . sample test
28 +SYS_LIBS =
29 +SYS_SRC =
30 +SYS_INCLUDES =
32 +endif
34 +libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(SYS_SRC)
35 +libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
36 libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0
38 include_HEADERS = event.h
40 -INCLUDES = -Icompat
41 +INCLUDES = -Icompat $(SYS_INCLUDES)
43 man_MANS = event.3
45 === WIN32-Code/misc.c
46 ==================================================================
47 --- WIN32-Code/misc.c (revision 8794)
48 +++ WIN32-Code/misc.c (local)
49 @@ -4,6 +4,12 @@
50 #include <sys/timeb.h>
51 #include <time.h>
53 +#ifdef __GNUC__
54 +/*our prototypes for timeval and timezone are in here, just in case the above
55 + headers don't have them*/
56 +#include "misc.h"
57 +#endif
59 /****************************************************************************
61 * Function: gettimeofday(struct timeval *, struct timezone *)
62 @@ -17,6 +23,7 @@
64 ****************************************************************************/
66 +#ifndef HAVE_GETTIMEOFDAY
67 int gettimeofday(struct timeval *tv, struct timezone *tz) {
68 struct _timeb tb;
70 @@ -28,6 +35,7 @@
71 tv->tv_usec = ((int) tb.millitm) * 1000;
72 return 0;
74 +#endif
76 int
77 win_read(int fd, void *buf, unsigned int length)
78 === WIN32-Code/misc.h
79 ==================================================================
80 --- WIN32-Code/misc.h (revision 8794)
81 +++ WIN32-Code/misc.h (local)
82 @@ -1,6 +1,11 @@
83 #ifndef MISC_H
84 #define MISC_H
86 +struct timezone;
87 +struct timeval;
89 +#ifndef HAVE_GETTIMEOFDAY
90 int gettimeofday(struct timeval *,struct timezone *);
91 +#endif
93 #endif
94 === WIN32-Code/win32.c
95 ==================================================================
96 --- WIN32-Code/win32.c (revision 8794)
97 +++ WIN32-Code/win32.c (local)
98 @@ -60,7 +60,8 @@
99 /* MSDN says this is required to handle SIGFPE */
100 volatile double SIGFPE_REQ = 0.0f;
102 -int signal_handler(int sig);
103 +static void signal_handler(int sig);
105 void signal_process(void);
106 int signal_recalc(void);
108 @@ -205,8 +206,9 @@
112 -win32_insert(struct win32op *win32op, struct event *ev)
113 +win32_insert(void *op, struct event *ev)
115 + struct win32op *win32op = op;
116 int i;
118 if (ev->ev_events & EV_SIGNAL) {
119 @@ -251,8 +253,9 @@
123 -win32_del(struct win32op *win32op, struct event *ev)
124 +win32_del(void *op, struct event *ev)
126 + struct win32op *win32op = op;
127 int i, found;
129 if (ev->ev_events & EV_SIGNAL)
130 @@ -302,9 +305,10 @@
134 -win32_dispatch(struct event_base *base, struct win32op *win32op,
135 +win32_dispatch(struct event_base *base, void *op,
136 struct timeval *tv)
138 + struct win32op *win32op = op;
139 int res = 0;
140 int i;
141 int fd_count;
142 @@ -366,13 +370,11 @@
146 -static int
147 +static void
148 signal_handler(int sig)
150 evsigcaught[sig]++;
151 signal_caught = 1;
153 - return 0;
157 === buffer.c
158 ==================================================================
159 --- buffer.c (revision 8794)
160 +++ buffer.c (local)
161 @@ -197,7 +197,7 @@
162 u_char *data = EVBUFFER_DATA(buffer);
163 size_t len = EVBUFFER_LENGTH(buffer);
164 char *line;
165 - u_int i;
166 + unsigned int i;
168 for (i = 0; i < len; i++) {
169 if (data[i] == '\r' || data[i] == '\n')
170 === configure.in
171 ==================================================================
172 --- configure.in (revision 8794)
173 +++ configure.in (local)
174 @@ -111,6 +111,21 @@
178 +dnl - check if the macro WIN32 is defined on this compiler.
179 +dnl - (this is how we check for a windows version of GCC)
180 +AC_MSG_CHECKING(for WIN32)
181 +AC_TRY_COMPILE(,
183 + #ifndef WIN32
184 + #error
185 + #endif
186 + ],
187 + bwin32=true; AC_MSG_RESULT(yes),
188 + bwin32=false; AC_MSG_RESULT(no),
191 +AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
193 dnl Checks for typedefs, structures, and compiler characteristics.
194 AC_C_CONST
195 AC_C_INLINE
196 === evbuffer.c
197 ==================================================================
198 --- evbuffer.c (revision 8794)
199 +++ evbuffer.c (local)
200 @@ -154,12 +154,20 @@
201 if (EVBUFFER_LENGTH(bufev->output)) {
202 res = evbuffer_write(bufev->output, fd);
203 if (res == -1) {
204 +#ifndef WIN32
205 +/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not
206 + *set errno. thus this error checking is not portable*/
207 if (errno == EAGAIN ||
208 errno == EINTR ||
209 errno == EINPROGRESS)
210 goto reschedule;
211 /* error case */
212 what |= EVBUFFER_ERROR;
214 +#else
215 + goto reschedule;
216 +#endif
218 } else if (res == 0) {
219 /* eof case */
220 what |= EVBUFFER_EOF;