Index: head/lib/libstand/tftp.c =================================================================== --- head/lib/libstand/tftp.c +++ head/lib/libstand/tftp.c @@ -200,7 +200,7 @@ case DATA: { int got; - if (htons(t->th_block) != d->xid) { + if (htons(t->th_block) != (u_short) d->xid) { /* * Expected block? */ @@ -560,7 +560,7 @@ sb->st_nlink = 1; sb->st_uid = 0; sb->st_gid = 0; - sb->st_size = -1; + sb->st_size = (off_t) tftpfile->tftp_tsize; return (0); } @@ -731,6 +731,8 @@ } else if (strcasecmp(tftp_options[i], "tsize") == 0) { if (i + 1 < option_idx) tsize = strtol(tftp_options[i + 1], (char **)NULL, 10); + if (tsize != 0) + h->tftp_tsize = tsize; } else { /* Do not allow any options we did not expect to be ACKed. */ printf("unexpected tftp option '%s'\n", tftp_options[i]);