diff options
author | Mark Whitley <markw@lineo.com> | 2001-03-06 20:58:48 +0000 |
---|---|---|
committer | Mark Whitley <markw@lineo.com> | 2001-03-06 20:58:48 +0000 |
commit | 8bb7df49c24de71f28b47eb2e3b86fb5b2e9d42a (patch) | |
tree | 2bf5d94414a8e6d546514931d25787a4cc9b3df7 /networking/tftp.c | |
parent | 0f430e34af3471b5267cd6b00a803559ab7fb110 (diff) | |
download | busybox-w32-8bb7df49c24de71f28b47eb2e3b86fb5b2e9d42a.tar.gz busybox-w32-8bb7df49c24de71f28b47eb2e3b86fb5b2e9d42a.tar.bz2 busybox-w32-8bb7df49c24de71f28b47eb2e3b86fb5b2e9d42a.zip |
Applied patch from Vladimir Oleynik via Magnus Damm that removes newlines from
error_msg() calls and uses 'return EXIT_SUCCESS' instead of return 0.
Diffstat (limited to 'networking/tftp.c')
-rw-r--r-- | networking/tftp.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/networking/tftp.c b/networking/tftp.c index f56d6562e..e4e01b9a2 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -110,7 +110,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
110 | 110 | ||
111 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { | 111 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { |
112 | perror_msg("socket"); | 112 | perror_msg("socket"); |
113 | return 1; | 113 | return EXIT_FAILURE; |
114 | } | 114 | } |
115 | 115 | ||
116 | len = sizeof(sa); | 116 | len = sizeof(sa); |
@@ -157,7 +157,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
157 | } | 157 | } |
158 | 158 | ||
159 | if ((*cp != '\0') || (&buf[BUFSIZE - 1] - cp) < 7) { | 159 | if ((*cp != '\0') || (&buf[BUFSIZE - 1] - cp) < 7) { |
160 | error_msg("too long server-filename.\n"); | 160 | error_msg("too long server-filename"); |
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | 163 | ||
@@ -212,7 +212,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
212 | 212 | ||
213 | if (sendto(socketfd, buf, len, 0, | 213 | if (sendto(socketfd, buf, len, 0, |
214 | (struct sockaddr *) &sa, sizeof(sa)) < 0) { | 214 | (struct sockaddr *) &sa, sizeof(sa)) < 0) { |
215 | perror_msg("send()"); | 215 | perror_msg("send"); |
216 | len = -1; | 216 | len = -1; |
217 | break; | 217 | break; |
218 | } | 218 | } |
@@ -256,7 +256,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
256 | /* discard the packet - treat as timeout */ | 256 | /* discard the packet - treat as timeout */ |
257 | 257 | ||
258 | case 0: | 258 | case 0: |
259 | error_msg("timeout.\n"); | 259 | error_msg("timeout"); |
260 | 260 | ||
261 | if (!timeout) { | 261 | if (!timeout) { |
262 | timeout = BB_TFTP_NO_RETRIES; | 262 | timeout = BB_TFTP_NO_RETRIES; |
@@ -266,7 +266,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
266 | 266 | ||
267 | if (!timeout) { | 267 | if (!timeout) { |
268 | len = -1; | 268 | len = -1; |
269 | error_msg("last timeout!\n"); | 269 | error_msg("last timeout"); |
270 | } | 270 | } |
271 | break; | 271 | break; |
272 | 272 | ||
@@ -333,7 +333,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
333 | } | 333 | } |
334 | 334 | ||
335 | if (msg) { | 335 | if (msg) { |
336 | error_msg("server says: %s.\n", msg); | 336 | error_msg("server says: %s", msg); |
337 | } | 337 | } |
338 | 338 | ||
339 | break; | 339 | break; |
@@ -342,11 +342,7 @@ static inline int tftp(int cmd, struct hostent *host, | |||
342 | 342 | ||
343 | close(socketfd); | 343 | close(socketfd); |
344 | 344 | ||
345 | if (finished) { | 345 | return finished ? EXIT_SUCCESS : EXIT_FAILURE; |
346 | return 0; | ||
347 | } | ||
348 | |||
349 | return 1; | ||
350 | } | 346 | } |
351 | 347 | ||
352 | int tftp_main(int argc, char **argv) | 348 | int tftp_main(int argc, char **argv) |
@@ -402,7 +398,7 @@ int tftp_main(int argc, char **argv) | |||
402 | free(s); | 398 | free(s); |
403 | } | 399 | } |
404 | if (bad) { | 400 | if (bad) { |
405 | perror_msg_and_die("bad \"server:file\" combination"); | 401 | error_msg_and_die("bad \"server:file\" combination"); |
406 | } | 402 | } |
407 | 403 | ||
408 | if (BB_TFTP_DEBUG) { | 404 | if (BB_TFTP_DEBUG) { |