Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tftp PR/57166: John Dundas: Correct error code byte ...
details: https://anonhg.NetBSD.org/src/rev/5af6046d0dee
branches: trunk
changeset: 372940:5af6046d0dee
user: christos <christos%NetBSD.org@localhost>
date: Fri Jan 06 17:18:56 2023 +0000
description:
PR/57166: John Dundas: Correct error code byte order in error message
diffstat:
usr.bin/tftp/tftp.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diffs (94 lines):
diff -r 851edadf63ff -r 5af6046d0dee usr.bin/tftp/tftp.c
--- a/usr.bin/tftp/tftp.c Fri Jan 06 17:13:46 2023 +0000
+++ b/usr.bin/tftp/tftp.c Fri Jan 06 17:18:56 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.c,v 1.36 2016/09/03 06:00:32 dholland Exp $ */
+/* $NetBSD: tftp.c,v 1.37 2023/01/06 17:18:56 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: tftp.c,v 1.36 2016/09/03 06:00:32 dholland Exp $");
+__RCSID("$NetBSD: tftp.c,v 1.37 2023/01/06 17:18:56 christos Exp $");
#endif
#endif /* not lint */
@@ -260,7 +260,8 @@
/* size = read(fd, dp->th_data, SEGSIZE); */
size = readit(file, &dp, blksize, convert);
if (size < 0) {
- nak(errno + 100, (struct sockaddr *)(void *)&peer);
+ nak(errno + 100,
+ (struct sockaddr *)(void *)&peer);
break;
}
dp->th_opcode = htons((u_short)DATA);
@@ -309,8 +310,8 @@
/* should verify packet came from server */
ap->th_opcode = ntohs(ap->th_opcode);
if (ap->th_opcode == ERROR) {
- (void)printf("Error code %d: %s\n", ap->th_code,
- ap->th_msg);
+ (void)printf("Error code %d: %s\n",
+ ntohs(ap->th_code), ap->th_msg);
goto abort;
}
if (ap->th_opcode == ACK) {
@@ -454,8 +455,8 @@
/* should verify client address */
dp->th_opcode = ntohs(dp->th_opcode);
if (dp->th_opcode == ERROR) {
- (void)printf("Error code %d: %s\n", dp->th_code,
- dp->th_msg);
+ (void)printf("Error code %d: %s\n",
+ ntohs(dp->th_code), dp->th_msg);
goto abort;
}
if (dp->th_opcode == DATA) {
@@ -474,7 +475,8 @@
*/
j = synchnet(f, blksize);
if (j && trace) {
- (void)printf("discarded %d packets\n", j);
+ (void)printf("discarded %d packets\n",
+ j);
}
if (dp->th_block == (block-1)) {
goto send_ack; /* resend ack */
@@ -674,7 +676,8 @@
break;
case DATA:
- (void)printf("<block=%d, %d bytes>\n", ntohs(tp->th_block), n - 4);
+ (void)printf("<block=%d, %d bytes>\n", ntohs(tp->th_block),
+ n - 4);
break;
case ACK:
@@ -682,7 +685,8 @@
break;
case ERROR:
- (void)printf("<code=%d, msg=%s>\n", ntohs(tp->th_code), tp->th_msg);
+ (void)printf("<code=%d, msg=%s>\n", ntohs(tp->th_code),
+ tp->th_msg);
break;
case OACK:
@@ -761,9 +765,11 @@
{
char a[NI_MAXSERV], b[NI_MAXSERV];
- if (getnameinfo(sa, (socklen_t)sa->sa_len, NULL, 0, a, sizeof(a), NI_NUMERICSERV))
+ if (getnameinfo(sa, (socklen_t)sa->sa_len, NULL, 0, a, sizeof(a),
+ NI_NUMERICSERV))
return 0;
- if (getnameinfo(sb, (socklen_t)sb->sa_len, NULL, 0, b, sizeof(b), NI_NUMERICSERV))
+ if (getnameinfo(sb, (socklen_t)sb->sa_len, NULL, 0, b, sizeof(b),
+ NI_NUMERICSERV))
return 0;
if (strcmp(a, b) != 0)
return 0;
Home |
Main Index |
Thread Index |
Old Index