Date: Fri, 17 Oct 2008 22:26:38 +0000 (UTC) From: Edwin Groothuis <edwin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r183993 - user/edwin/tftpd/usr.bin/tftp Message-ID: <200810172226.m9HMQcpI099420@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: edwin Date: Fri Oct 17 22:26:38 2008 New Revision: 183993 URL: http://svn.freebsd.org/changeset/base/183993 Log: Add OP_ prefixes to packet types as defined in arpa/tftp.h. Add TFTP_ prefixes to error codes as defined in arpa/tftp.h. This all to avoid confusion (which is a good thing!) Submitted by: netchild@, rink@ and others Modified: user/edwin/tftpd/usr.bin/tftp/tftp.c Modified: user/edwin/tftpd/usr.bin/tftp/tftp.c ============================================================================== --- user/edwin/tftpd/usr.bin/tftp/tftp.c Fri Oct 17 22:19:08 2008 (r183992) +++ user/edwin/tftpd/usr.bin/tftp/tftp.c Fri Oct 17 22:26:38 2008 (r183993) @@ -134,7 +134,7 @@ xmitfile(int peer, char *port, int fd, c printf("Transfer timed out.\n"); return; } - if (rp->th_opcode == ERROR) { + if (rp->th_opcode == OP_ERROR) { printf("Got ERROR, aborted\n"); return; } @@ -143,10 +143,10 @@ xmitfile(int peer, char *port, int fd, c * If the first packet is an OACK instead of an ACK packet, * handle it different. */ - if (rp->th_opcode == OACK) { + if (rp->th_opcode == OP_OACK) { if (!options_rfc_enabled) { printf("Got OACK while options are not enabled!\n"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return; } @@ -230,7 +230,7 @@ recvfile(int peer, char *port, int fd, c break; } - if (rp->th_opcode == ERROR) { + if (rp->th_opcode == OP_ERROR) { tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg); return; } @@ -246,10 +246,10 @@ recvfile(int peer, char *port, int fd, c * If the first packet is an OACK packet instead of an DATA packet, * handle it different. */ - if (rp->th_opcode == OACK) { + if (rp->th_opcode == OP_OACK) { if (!options_rfc_enabled) { printf("Got OACK while options are not enabled!\n"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810172226.m9HMQcpI099420>