diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 17:55:51 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 17:55:51 +0000 |
commit | dac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch) | |
tree | 0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /networking/tftp.c | |
parent | 79865bc5077cf6d17b27e9599921d4c85b1575fd (diff) | |
download | busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.bz2 busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.zip |
- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it.
Also use shorter boilerplate while at it.
Diffstat (limited to 'networking/tftp.c')
-rw-r--r-- | networking/tftp.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/networking/tftp.c b/networking/tftp.c index ddcb5225f..b830f18a5 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -1,35 +1,23 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* tftp.c */ | 2 | /* ------------------------------------------------------------------------- |
3 | /* */ | 3 | * tftp.c |
4 | /* A simple tftp client for busybox. */ | 4 | * |
5 | /* Tries to follow RFC1350. */ | 5 | * A simple tftp client for busybox. |
6 | /* Only "octet" mode supported. */ | 6 | * Tries to follow RFC1350. |
7 | /* Optional blocksize negotiation (RFC2347 + RFC2348) */ | 7 | * Only "octet" mode supported. |
8 | /* */ | 8 | * Optional blocksize negotiation (RFC2347 + RFC2348) |
9 | /* Copyright (C) 2001 Magnus Damm <damm@opensource.se> */ | 9 | * |
10 | /* */ | 10 | * Copyright (C) 2001 Magnus Damm <damm@opensource.se> |
11 | /* Parts of the code based on: */ | 11 | * |
12 | /* */ | 12 | * Parts of the code based on: |
13 | /* atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> */ | 13 | * |
14 | /* and Remi Lefebvre <remi@debian.org> */ | 14 | * atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> |
15 | /* */ | 15 | * and Remi Lefebvre <remi@debian.org> |
16 | /* utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> */ | 16 | * |
17 | /* */ | 17 | * utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> |
18 | /* This program is free software; you can redistribute it and/or modify */ | 18 | * |
19 | /* it under the terms of the GNU General Public License as published by */ | 19 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
20 | /* the Free Software Foundation; either version 2 of the License, or */ | 20 | * ------------------------------------------------------------------------- */ |
21 | /* (at your option) any later version. */ | ||
22 | /* */ | ||
23 | /* This program is distributed in the hope that it will be useful, */ | ||
24 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | ||
25 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ | ||
26 | /* General Public License for more details. */ | ||
27 | /* */ | ||
28 | /* You should have received a copy of the GNU General Public License */ | ||
29 | /* along with this program; if not, write to the Free Software */ | ||
30 | /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | ||
31 | /* */ | ||
32 | /* ------------------------------------------------------------------------- */ | ||
33 | 21 | ||
34 | #include <stdio.h> | 22 | #include <stdio.h> |
35 | #include <stdlib.h> | 23 | #include <stdlib.h> |
@@ -177,7 +165,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
177 | 165 | ||
178 | tftp_bufsize += 4; | 166 | tftp_bufsize += 4; |
179 | 167 | ||
180 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { | 168 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { /* bb_xsocket? */ |
181 | bb_perror_msg("socket"); | 169 | bb_perror_msg("socket"); |
182 | return EXIT_FAILURE; | 170 | return EXIT_FAILURE; |
183 | } | 171 | } |