+ if (blksize != TFTP_BLKSIZE_DEFAULT || want_transfer_size) {
+ /* Create and send OACK packet. */
+ /* For the download case, block_nr is still 1 -
+ * we expect 1st ACK from peer to be for (block_nr-1),
+ * that is, for "block 0" which is our OACK pkt */
+ opcode = TFTP_OACK;
+ goto add_blksize_opt;
+ }
+#endif
+ if (CMD_GET(option_mask32)) {
+ /* It's upload and we don't send OACK.
+ * We must ACK 1st packet (with filename)
+ * as if it is "block 0" */
+ block_nr = 0;
+ }
+
+ } else { /* tftp */
+ /* Open file (must be after changing user) */
+ local_fd = CMD_GET(option_mask32) ? STDOUT_FILENO : STDIN_FILENO;
+ if (NOT_LONE_DASH(local_file))
+ local_fd = xopen(local_file, open_mode);
+/* Removing #if, or using if() statement instead of #if may lead to
+ * "warning: null argument where non-null required": */
+#if ENABLE_TFTP
+ /* tftp */
+
+ /* We can't (and don't really need to) bind the socket:
+ * we don't know from which local IP datagrams will be sent,
+ * but kernel will pick the same IP every time (unless routing
+ * table is changed), thus peer will see dgrams consistently
+ * coming from the same IP.
+ * We would like to connect the socket, but since peer's
+ * UDP code can be less perfect than ours, _peer's_ IP:port
+ * in replies may differ from IP:port we used to send
+ * our first packet. We can connect() only when we get
+ * first reply. */
+
+ /* build opcode */
+ opcode = TFTP_WRQ;
+ if (CMD_GET(option_mask32)) {
+ opcode = TFTP_RRQ;
+ }
+ /* add filename and mode */
+ /* fill in packet if the filename fits into xbuf */
+ len = strlen(remote_file) + 1;
+ if (2 + len + sizeof("octet") >= io_bufsize) {