]>
Commit | Line | Data |
---|---|---|
e00b5ea6 AM |
1 | --- atftp-0.7.dfsg.orig/tftpd.c |
2 | +++ atftp-0.7.dfsg/tftpd.c | |
3 | @@ -157,6 +157,7 @@ | |
4 | struct servent *serv; | |
5 | struct passwd *user; | |
6 | struct group *group; | |
7 | + pthread_t tid; | |
8 | ||
9 | #ifdef HAVE_MTFTP | |
10 | pthread_t mtftp_thread; | |
11 | @@ -300,11 +301,13 @@ | |
12 | open_logger("atftpd", log_file, logging_level); | |
13 | } | |
14 | ||
15 | +#ifdef SOL_IP | |
16 | /* We need to retieve some information from incomming packets */ | |
17 | if (setsockopt(0, SOL_IP, IP_PKTINFO, &one, sizeof(one)) != 0) | |
18 | { | |
19 | logger(LOG_WARNING, "Failed to set socket option: %s", strerror(errno)); | |
20 | } | |
21 | +#endif | |
22 | ||
23 | /* save main thread ID for proper signal handling */ | |
24 | main_thread_id = pthread_self(); | |
25 | @@ -466,7 +469,7 @@ | |
26 | new->client_info->next = NULL; | |
27 | ||
28 | /* Start a new server thread. */ | |
29 | - if (pthread_create(&new->tid, NULL, tftpd_receive_request, | |
30 | + if (pthread_create(&tid, NULL, tftpd_receive_request, | |
31 | (void *)new) != 0) | |
32 | { | |
33 | logger(LOG_ERR, "Failed to start new thread"); | |
34 | @@ -567,7 +570,8 @@ | |
35 | ||
36 | /* Detach ourself. That way the main thread does not have to | |
37 | * wait for us with pthread_join. */ | |
38 | - pthread_detach(pthread_self()); | |
39 | + data->tid = pthread_self(); | |
40 | + pthread_detach(data->tid); | |
41 | ||
42 | /* Read the first packet from stdin. */ | |
43 | data_size = data->data_buffer_size; | |
44 | @@ -732,8 +736,8 @@ | |
45 | tftpd_clientlist_free(data); | |
46 | ||
47 | /* free the thread structure */ | |
48 | - free(data); | |
49 | - | |
50 | + free(data); | |
51 | + | |
52 | logger(LOG_INFO, "Server thread exiting"); | |
53 | pthread_exit(NULL); | |
54 | } | |
55 | --- atftp-0.7.dfsg.orig/argz.h | |
56 | +++ atftp-0.7.dfsg/argz.h | |
57 | @@ -180,7 +180,7 @@ | |
58 | #ifdef __USE_EXTERN_INLINES | |
59 | extern inline char * | |
60 | __argz_next (__const char *__argz, size_t __argz_len, | |
61 | - __const char *__entry) __THROW | |
62 | + __const char *__entry) | |
63 | { | |
64 | if (__entry) | |
65 | { | |
66 | @@ -194,7 +194,7 @@ | |
67 | } | |
68 | extern inline char * | |
69 | argz_next (__const char *__argz, size_t __argz_len, | |
70 | - __const char *__entry) __THROW | |
71 | + __const char *__entry) | |
72 | { | |
73 | return __argz_next (__argz, __argz_len, __entry); | |
74 | } | |
75 | --- atftp-0.7.dfsg.orig/Makefile.am | |
76 | +++ atftp-0.7.dfsg/Makefile.am | |
77 | @@ -32,7 +32,7 @@ | |
78 | argz.c tftp_mtftp.c | |
79 | ||
80 | sbin_PROGRAMS = atftpd | |
81 | -atftpd_LDADD = $(LIBPTHREAD) $(LIBWRAP) $(LIBPCRE) | |
82 | +atftpd_LDADD = $(LIBWRAP) $(LIBPTHREAD) $(LIBPCRE) | |
83 | atftpd_SOURCES = tftpd.c logger.c options.c stats.c tftp_io.c tftp_def.c \ | |
84 | tftpd_file.c tftpd_list.c tftpd_mcast.c argz.c tftpd_pcre.c \ | |
85 | tftpd_mtftp.c | |
86 | --- atftp-0.7.dfsg.orig/tftp_io.c | |
87 | +++ atftp-0.7.dfsg/tftp_io.c | |
88 | @@ -284,12 +284,14 @@ | |
89 | cmsg != NULL && cmsg->cmsg_len >= sizeof(*cmsg); | |
90 | cmsg = CMSG_NXTHDR(&msg, cmsg)) | |
91 | { | |
92 | +#ifdef SOL_IP | |
93 | if (cmsg->cmsg_level == SOL_IP | |
94 | && cmsg->cmsg_type == IP_PKTINFO) | |
95 | { | |
96 | pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg); | |
97 | sa_to->sin_addr = pktinfo->ipi_addr; | |
98 | } | |
99 | +#endif | |
100 | break; | |
101 | } | |
102 | } | |
103 | --- atftp-0.7.dfsg.orig/tftp.c | |
104 | +++ atftp-0.7.dfsg/tftp.c | |
105 | @@ -354,7 +354,7 @@ | |
106 | void make_arg(char *string, int *argc, char ***argv) | |
107 | { | |
108 | static char *tmp = NULL; | |
109 | - int argz_len; | |
110 | + size_t argz_len; | |
111 | ||
112 | /* split the string to an argz vector */ | |
113 | if (argz_create_sep(string, ' ', &tmp, &argz_len) != 0) | |
114 | @@ -731,7 +731,7 @@ | |
115 | fsync(data.sockfd); | |
116 | close(data.sockfd); | |
117 | ||
118 | - return OK; | |
119 | + return tftp_result; | |
120 | } | |
121 | ||
122 | #ifdef HAVE_MTFTP | |
123 | --- atftp-0.7.dfsg.orig/tftp_file.c | |
124 | +++ atftp-0.7.dfsg/tftp_file.c | |
125 | @@ -59,7 +59,7 @@ | |
126 | unsigned int next_word; | |
127 | ||
128 | /* initial stuff */ | |
129 | - next_hole = prev_hole + 1; | |
130 | + next_hole = 0; /*prev_hole + 1;*/ | |
131 | next_word_no = next_hole / 32; | |
132 | next_bit_no = next_hole % 32; | |
133 | next_word = bitmap[next_word_no]; |