Commit ef2d54d8df7e4a515b603fe101e73f716d81e778
Committed by
Anthony Liguori
1 parent
f8e3cbd3
slirp: tftp: Clean up tftp_send_error
The return code of tftp_send_error is not used, drop it. And also make sure to always terminate the session. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
5 additions
and
8 deletions
slirp/tftp.c
@@ -167,11 +167,9 @@ static int tftp_send_oack(struct tftp_session *spt, | @@ -167,11 +167,9 @@ static int tftp_send_oack(struct tftp_session *spt, | ||
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | - | ||
171 | - | ||
172 | -static int tftp_send_error(struct tftp_session *spt, | ||
173 | - u_int16_t errorcode, const char *msg, | ||
174 | - struct tftp_t *recv_tp) | 170 | +static void tftp_send_error(struct tftp_session *spt, |
171 | + u_int16_t errorcode, const char *msg, | ||
172 | + struct tftp_t *recv_tp) | ||
175 | { | 173 | { |
176 | struct sockaddr_in saddr, daddr; | 174 | struct sockaddr_in saddr, daddr; |
177 | struct mbuf *m; | 175 | struct mbuf *m; |
@@ -181,7 +179,7 @@ static int tftp_send_error(struct tftp_session *spt, | @@ -181,7 +179,7 @@ static int tftp_send_error(struct tftp_session *spt, | ||
181 | m = m_get(); | 179 | m = m_get(); |
182 | 180 | ||
183 | if (!m) { | 181 | if (!m) { |
184 | - return -1; | 182 | + goto out; |
185 | } | 183 | } |
186 | 184 | ||
187 | memset(m->m_data, 0, m->m_size); | 185 | memset(m->m_data, 0, m->m_size); |
@@ -207,9 +205,8 @@ static int tftp_send_error(struct tftp_session *spt, | @@ -207,9 +205,8 @@ static int tftp_send_error(struct tftp_session *spt, | ||
207 | 205 | ||
208 | udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY); | 206 | udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY); |
209 | 207 | ||
208 | +out: | ||
210 | tftp_session_terminate(spt); | 209 | tftp_session_terminate(spt); |
211 | - | ||
212 | - return 0; | ||
213 | } | 210 | } |
214 | 211 | ||
215 | static int tftp_send_data(struct tftp_session *spt, | 212 | static int tftp_send_data(struct tftp_session *spt, |