diff options
author | Rob Landley <rob@landley.net> | 2020-04-15 00:51:12 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-04-15 00:51:12 -0500 |
commit | 8ea3ff4e32cf1ca4eb05ca7783ff90b564141c27 (patch) | |
tree | 8ae4e5f3c37d4f8fb3e7e8bf4cb854eab376c37f | |
parent | f2866cf58a07c9d681ecd6695ea969ac70e59a3d (diff) | |
download | toybox-8ea3ff4e32cf1ca4eb05ca7783ff90b564141c27.tar.gz |
Based on a patch from Ethan Sommer: silence warning and convert to FLAG()
-rw-r--r-- | toys/pending/tftp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/toys/pending/tftp.c b/toys/pending/tftp.c index 1e32fdf4..80f14392 100644 --- a/toys/pending/tftp.c +++ b/toys/pending/tftp.c @@ -132,7 +132,7 @@ static int mkpkt_err(uint8_t *buffer, uint16_t errorcode, char *errormsg) * Recieves data from server in BUFF with socket SD and updates FROM * and returns read length. */ -static ssize_t read_server(int sd, void *buf, size_t len, +static int read_server(int sd, void *buf, int len, struct sockaddr_storage *from) { socklen_t alen; @@ -214,7 +214,7 @@ static int read_ack(int sd, uint8_t *packet, struct sockaddr_storage *server, uint16_t *port, uint16_t *blockno) { struct sockaddr_storage from; - ssize_t nbytes; + int nbytes; uint16_t opcode, rblockno; int packetlen, retry; @@ -434,12 +434,12 @@ void tftp_main(void) struct addrinfo *info, rp, *res=0; int ret; - if (toys.optflags & FLAG_r) { - if (!(toys.optflags & FLAG_l)) { + if (FLAG(r)) { + if (!FLAG(l)) { char *slash = strrchr(TT.remote_file, '/'); TT.local_file = (slash) ? slash + 1 : TT.remote_file; } - } else if (toys.optflags & FLAG_l) TT.remote_file = TT.local_file; + } else if (FLAG(l)) TT.remote_file = TT.local_file; else error_exit("Please provide some files."); memset(&rp, 0, sizeof(rp)); @@ -457,6 +457,6 @@ void tftp_main(void) memcpy((void *)&TT.inaddr, info->ai_addr, info->ai_addrlen); freeaddrinfo(info); - if (toys.optflags & FLAG_g) file_get(); - if (toys.optflags & FLAG_p) file_put(); + if (FLAG(g)) file_get(); + if (FLAG(p)) file_put(); } |