1 --- atftp-0.7.dfsg.orig/tftpd.c
2 +++ atftp-0.7.dfsg/tftpd.c
10 pthread_t mtftp_thread;
12 open_logger("atftpd", log_file, logging_level);
16 /* We need to retieve some information from incomming packets */
17 if (setsockopt(0, SOL_IP, IP_PKTINFO, &one, sizeof(one)) != 0)
19 logger(LOG_WARNING, "Failed to set socket option: %s", strerror(errno));
23 /* save main thread ID for proper signal handling */
24 main_thread_id = pthread_self();
26 new->client_info->next = NULL;
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,
33 logger(LOG_ERR, "Failed to start new thread");
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);
42 /* Read the first packet from stdin. */
43 data_size = data->data_buffer_size;
45 tftpd_clientlist_free(data);
47 /* free the thread structure */
52 logger(LOG_INFO, "Server thread exiting");
55 --- atftp-0.7.dfsg.orig/argz.h
56 +++ atftp-0.7.dfsg/argz.h
58 #ifdef __USE_EXTERN_INLINES
60 __argz_next (__const char *__argz, size_t __argz_len,
61 - __const char *__entry) __THROW
62 + __const char *__entry)
69 argz_next (__const char *__argz, size_t __argz_len,
70 - __const char *__entry) __THROW
71 + __const char *__entry)
73 return __argz_next (__argz, __argz_len, __entry);
75 --- atftp-0.7.dfsg.orig/Makefile.am
76 +++ atftp-0.7.dfsg/Makefile.am
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 \
86 --- atftp-0.7.dfsg.orig/tftp_io.c
87 +++ atftp-0.7.dfsg/tftp_io.c
89 cmsg != NULL && cmsg->cmsg_len >= sizeof(*cmsg);
90 cmsg = CMSG_NXTHDR(&msg, cmsg))
93 if (cmsg->cmsg_level == SOL_IP
94 && cmsg->cmsg_type == IP_PKTINFO)
96 pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg);
97 sa_to->sin_addr = pktinfo->ipi_addr;
103 --- atftp-0.7.dfsg.orig/tftp.c
104 +++ atftp-0.7.dfsg/tftp.c
106 void make_arg(char *string, int *argc, char ***argv)
108 static char *tmp = NULL;
112 /* split the string to an argz vector */
113 if (argz_create_sep(string, ' ', &tmp, &argz_len) != 0)
119 + return tftp_result;
123 --- atftp-0.7.dfsg.orig/tftp_file.c
124 +++ atftp-0.7.dfsg/tftp_file.c
126 unsigned int next_word;
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];