Mercurial > pidgin
comparison libpurple/dnssrv.c @ 15712:4530f15fe5af
Patch from Graham Booker which ensures that a process forked by dnsserv cleans up afterwards, calling waitpid() to make sure no zombies are left over.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Sun, 25 Feb 2007 23:50:54 +0000 |
parents | ca1c878be941 |
children | 76bdff454d6f 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15711:7ac07c5fb1c2 | 15712:4530f15fe5af |
---|---|
65 #ifdef _WIN32 | 65 #ifdef _WIN32 |
66 GThread *resolver; | 66 GThread *resolver; |
67 char *query; | 67 char *query; |
68 char *error_message; | 68 char *error_message; |
69 GSList *results; | 69 GSList *results; |
70 #else | |
71 pid_t pid; | |
70 #endif | 72 #endif |
71 }; | 73 }; |
72 | 74 |
73 static gint | 75 static gint |
74 responsecompare(gconstpointer ar, gconstpointer br) | 76 responsecompare(gconstpointer ar, gconstpointer br) |
186 GaimSrvQueryData *query_data = (GaimSrvQueryData*)data; | 188 GaimSrvQueryData *query_data = (GaimSrvQueryData*)data; |
187 GaimSrvResponse *res; | 189 GaimSrvResponse *res; |
188 GaimSrvResponse *tmp; | 190 GaimSrvResponse *tmp; |
189 int i; | 191 int i; |
190 GaimSrvCallback cb = query_data->cb; | 192 GaimSrvCallback cb = query_data->cb; |
193 int status; | |
191 | 194 |
192 read(source, &size, sizeof(int)); | 195 read(source, &size, sizeof(int)); |
193 gaim_debug_info("dnssrv","found %d SRV entries\n", size); | 196 gaim_debug_info("dnssrv","found %d SRV entries\n", size); |
194 tmp = res = g_new0(GaimSrvResponse, size); | 197 tmp = res = g_new0(GaimSrvResponse, size); |
195 for (i = 0; i < size; i++) { | 198 for (i = 0; i < size; i++) { |
196 read(source, tmp++, sizeof(GaimSrvResponse)); | 199 read(source, tmp++, sizeof(GaimSrvResponse)); |
197 } | 200 } |
198 | 201 |
199 cb(res, size, query_data->extradata); | 202 cb(res, size, query_data->extradata); |
203 waitpid(query_data->pid, &status, 0); | |
200 | 204 |
201 gaim_srv_cancel(query_data); | 205 gaim_srv_cancel(query_data); |
202 } | 206 } |
203 | 207 |
204 #else /* _WIN32 */ | 208 #else /* _WIN32 */ |
342 gaim_debug_error("dnssrv", "Could not write to SRV resolver\n"); | 346 gaim_debug_error("dnssrv", "Could not write to SRV resolver\n"); |
343 | 347 |
344 query_data = g_new0(GaimSrvQueryData, 1); | 348 query_data = g_new0(GaimSrvQueryData, 1); |
345 query_data->cb = cb; | 349 query_data->cb = cb; |
346 query_data->extradata = extradata; | 350 query_data->extradata = extradata; |
351 query_data->pid = pid; | |
347 query_data->handle = gaim_input_add(out[0], GAIM_INPUT_READ, resolved, query_data); | 352 query_data->handle = gaim_input_add(out[0], GAIM_INPUT_READ, resolved, query_data); |
348 | 353 |
349 g_free(query); | 354 g_free(query); |
350 | 355 |
351 return query_data; | 356 return query_data; |