Lines 1-42
Link Here
|
1 |
--- src/eb.c.orig Mon Nov 18 18:13:06 2002 |
|
|
2 |
+++ src/eb.c Mon Feb 24 02:06:33 2003 |
3 |
@@ -24,6 +24,7 @@ |
4 |
#include <iconv.h> |
5 |
#include <langinfo.h> |
6 |
#include <wchar.h> |
7 |
+#include <pthread.h> |
8 |
|
9 |
|
10 |
#define MAX_HITS 50 |
11 |
@@ -1746,7 +1747,8 @@ |
12 |
DICT_GROUP *group; |
13 |
char word[65535]; |
14 |
|
15 |
- strcpy(word, arg); |
16 |
+ strncpy(word, arg, sizeof(word)-1); |
17 |
+ word[sizeof(word)-1] = '\0'; |
18 |
|
19 |
group_item = g_list_first(group_list); |
20 |
while(group_item != NULL){ |
21 |
@@ -1854,15 +1856,19 @@ |
22 |
{ |
23 |
gint rc; |
24 |
gint method; |
25 |
+ pthread_attr_t thread_attr; |
26 |
|
27 |
thread_running = 1; |
28 |
hit_count = 0; |
29 |
- rc = pthread_create(&tid, NULL, ebook_search_thread, (void *)word); |
30 |
+ |
31 |
+ pthread_attr_init(&thread_attr); |
32 |
+ pthread_attr_setstacksize(&thread_attr, 256*1024); |
33 |
+ rc = pthread_create(&tid, &thread_attr, ebook_search_thread, (void *)word); |
34 |
if(rc != 0){ |
35 |
perror("pthread_create"); |
36 |
exit(1); |
37 |
} |
38 |
- |
39 |
+ pthread_attr_destroy(&thread_attr); |
40 |
|
41 |
method = ebook_search_method(); |
42 |
if(method == SEARCH_METHOD_FULL_TEXT){ |