Adjust tftp_put return values
This commit is contained in:
parent
cac4275e60
commit
917b2d9578
2 changed files with 9 additions and 4 deletions
3
nmrp.c
3
nmrp.c
|
@ -436,8 +436,9 @@ int nmrp_do(struct nmrpd_args *args)
|
|||
printf("OK\nWaiting for remote to respond.\n");
|
||||
ethsock_set_timeout(sock, args->ul_timeout);
|
||||
expect = NMRP_C_CLOSE_REQ;
|
||||
} else if (err == -2) {
|
||||
expect = NMRP_C_TFTP_UL_REQ;
|
||||
} else {
|
||||
printf("\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
10
tftp.c
10
tftp.c
|
@ -149,12 +149,12 @@ static ssize_t tftp_recvfrom(int sock, char *pkt, uint16_t* port,
|
|||
* at offset 0. The limit of 32 chars is arbitrary.
|
||||
*/
|
||||
fprintf(stderr, "Error: %.32s\n", pkt);
|
||||
return -3;
|
||||
return -2;
|
||||
} else if (!opcode || opcode > ERR) {
|
||||
fprintf(stderr, "Received invalid packet: ");
|
||||
pkt_print(pkt, stderr);
|
||||
fprintf(stderr, ".\n");
|
||||
return -2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbosity > 2) {
|
||||
|
@ -307,8 +307,12 @@ int tftp_put(struct nmrpd_args *args)
|
|||
} else if (!ret) {
|
||||
if (++timeout < 5) {
|
||||
continue;
|
||||
} else if (block) {
|
||||
fprintf(stderr, "Timeout while waiting for ACK(%d).\n", block);
|
||||
} else {
|
||||
fprintf(stderr, "Timeout while waiting for initial reply.\n");
|
||||
}
|
||||
fprintf(stderr, "Timeout while waiting for ACK(%d).\n", block);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
} else {
|
||||
timeout = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue