aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 22:51:25 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 22:51:25 +0000
commitb6aae0f38194cd39960a898606ee65d4be93a895 (patch)
treeb73c92aefaf614291a71d05e9d28ca68f4ef021b /networking
parenta41fdf331af344ecd3ec230a072857ea197e1890 (diff)
downloadbusybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz
busybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.tar.bz2
busybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.zip
preparatory patch for -Wwrite-strings #2
Diffstat (limited to 'networking')
-rw-r--r--networking/arping.c2
-rw-r--r--networking/ftpgetput.c4
-rw-r--r--networking/inetd.c2
-rw-r--r--networking/libiproute/utils.c2
-rw-r--r--networking/libiproute/utils.h5
-rw-r--r--networking/netstat.c14
-rw-r--r--networking/route.c2
-rw-r--r--networking/telnet.c2
-rw-r--r--networking/udhcp/common.h4
-rw-r--r--networking/udhcp/dhcpc.h4
-rw-r--r--networking/udhcp/script.c2
-rw-r--r--networking/udhcp/socket.c4
-rw-r--r--networking/wget.c18
13 files changed, 33 insertions, 32 deletions
diff --git a/networking/arping.c b/networking/arping.c
index 725b0e4cb..7bab0d048 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -240,7 +240,7 @@ static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
240 240
241int arping_main(int argc, char **argv) 241int arping_main(int argc, char **argv)
242{ 242{
243 char *device = "eth0"; 243 const char *device = "eth0";
244 int ifindex; 244 int ifindex;
245 char *source = NULL; 245 char *source = NULL;
246 char *target; 246 char *target;
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index ccc0b5e46..590b7ebcd 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -17,8 +17,8 @@
17#include <getopt.h> 17#include <getopt.h>
18 18
19typedef struct ftp_host_info_s { 19typedef struct ftp_host_info_s {
20 char *user; 20 const char *user;
21 char *password; 21 const char *password;
22 struct len_and_sockaddr *lsa; 22 struct len_and_sockaddr *lsa;
23} ftp_host_info_t; 23} ftp_host_info_t;
24 24
diff --git a/networking/inetd.c b/networking/inetd.c
index c1f9918f0..5e7005e9b 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -327,7 +327,7 @@ static int timingout;
327static struct servent *sp; 327static struct servent *sp;
328static uid_t uid; 328static uid_t uid;
329 329
330static char *CONFIG = _PATH_INETDCONF; 330static const char *CONFIG = _PATH_INETDCONF;
331 331
332static FILE *fconfig; 332static FILE *fconfig;
333static char line[1024]; 333static char line[1024];
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 7e74e1c4b..5e06656f6 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -259,7 +259,7 @@ void duparg2(char *key, char *arg)
259 exit(-1); 259 exit(-1);
260} 260}
261 261
262int matches(char *cmd, char *pattern) 262int matches(const char *cmd, const char *pattern)
263{ 263{
264 int len = strlen(cmd); 264 int len = strlen(cmd);
265 265
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index c8ac63197..5af8ba744 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -43,8 +43,7 @@ typedef struct
43#define AF_DECnet 12 43#define AF_DECnet 12
44#endif 44#endif
45 45
46struct dn_naddr 46struct dn_naddr {
47{
48 unsigned short a_len; 47 unsigned short a_len;
49 unsigned char a_addr[DN_MAXADDL]; 48 unsigned char a_addr[DN_MAXADDL];
50}; 49};
@@ -79,7 +78,7 @@ extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int bufle
79void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN; 78void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN;
80void duparg(char *, char *) ATTRIBUTE_NORETURN; 79void duparg(char *, char *) ATTRIBUTE_NORETURN;
81void duparg2(char *, char *) ATTRIBUTE_NORETURN; 80void duparg2(char *, char *) ATTRIBUTE_NORETURN;
82int matches(char *arg, char *pattern); 81int matches(const char *arg, const char *pattern);
83extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits); 82extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits);
84 83
85const char *dnet_ntop(int af, const void *addr, char *str, size_t len); 84const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
diff --git a/networking/netstat.c b/networking/netstat.c
index 16ee52d9a..a5631c3c0 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -68,9 +68,10 @@ typedef enum {
68#define SO_WAITDATA (1<<17) /* wait data to read */ 68#define SO_WAITDATA (1<<17) /* wait data to read */
69#define SO_NOSPACE (1<<18) /* no space to write */ 69#define SO_NOSPACE (1<<18) /* no space to write */
70 70
71static char *get_sname(int port, const char *proto, int num) 71static const char *get_sname(int port, const char *proto, int num)
72{ 72{
73 char *str = itoa(ntohs(port)); 73 /* hummm, we return static buffer here!! */
74 const char *str = itoa(ntohs(port));
74 if (!num) { 75 if (!num) {
75 struct servent *se = getservbyport(port, proto); 76 struct servent *se = getservbyport(port, proto);
76 if (se) 77 if (se)
@@ -82,9 +83,9 @@ static char *get_sname(int port, const char *proto, int num)
82 return str; 83 return str;
83} 84}
84 85
85static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, char *proto, int numeric) 86static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, const char *proto, int numeric)
86{ 87{
87 char *port_name; 88 const char *port_name;
88 89
89#if ENABLE_FEATURE_IPV6 90#if ENABLE_FEATURE_IPV6
90 if (addr->sa_family == AF_INET6) { 91 if (addr->sa_family == AF_INET6) {
@@ -178,7 +179,8 @@ static void tcp_do_one(int lnr, const char *line)
178static void udp_do_one(int lnr, const char *line) 179static void udp_do_one(int lnr, const char *line)
179{ 180{
180 char local_addr[64], rem_addr[64]; 181 char local_addr[64], rem_addr[64];
181 char *state_str, more[512]; 182 const char *state_str;
183 char more[512];
182 int num, local_port, rem_port, d, state, timer_run, uid, timeout; 184 int num, local_port, rem_port, d, state, timer_run, uid, timeout;
183#if ENABLE_FEATURE_IPV6 185#if ENABLE_FEATURE_IPV6
184 struct sockaddr_in6 localaddr, remaddr; 186 struct sockaddr_in6 localaddr, remaddr;
@@ -356,7 +358,7 @@ static void unix_do_one(int nr, const char *line)
356{ 358{
357 static int has = 0; 359 static int has = 0;
358 char path[PATH_MAX], ss_flags[32]; 360 char path[PATH_MAX], ss_flags[32];
359 char *ss_proto, *ss_state, *ss_type; 361 const char *ss_proto, *ss_state, *ss_type;
360 int num, state, type, inode; 362 int num, state, type, inode;
361 void *d; 363 void *d;
362 unsigned long refcnt, proto, unix_flags; 364 unsigned long refcnt, proto, unix_flags;
diff --git a/networking/route.c b/networking/route.c
index 56c6f46c6..d32011cc4 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -296,7 +296,7 @@ static void INET_setroute(int action, char **args)
296 296
297#ifdef RTF_REJECT 297#ifdef RTF_REJECT
298 if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) { 298 if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) {
299 rt.rt_dev = "lo"; 299 rt.rt_dev = (char*)"lo";
300 } 300 }
301#endif 301#endif
302 302
diff --git a/networking/telnet.c b/networking/telnet.c
index fc70cc406..7407fa413 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -322,7 +322,7 @@ static void putiac_subopt(byte c, char *str)
322static void putiac_subopt_autologin(void) 322static void putiac_subopt_autologin(void)
323{ 323{
324 int len = strlen(autologin) + 6; // (2 + 1 + 1 + strlen + 2) 324 int len = strlen(autologin) + 6; // (2 + 1 + 1 + strlen + 2)
325 char *user = "USER"; 325 const char *user = "USER";
326 326
327 if (G.iaclen + len > IACBUFSIZE) 327 if (G.iaclen + len > IACBUFSIZE)
328 iacflush(); 328 iacflush();
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index ca05a9c2c..a80691b4a 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -89,8 +89,8 @@ void udhcp_sp_setup(void);
89int udhcp_sp_fd_set(fd_set *rfds, int extra_fd); 89int udhcp_sp_fd_set(fd_set *rfds, int extra_fd);
90int udhcp_sp_read(fd_set *rfds); 90int udhcp_sp_read(fd_set *rfds);
91int raw_socket(int ifindex); 91int raw_socket(int ifindex);
92int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp); 92int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
93int listen_socket(uint32_t ip, int port, char *inf); 93int listen_socket(uint32_t ip, int port, const char *inf);
94int pidfile_acquire(const char *pidfile); 94int pidfile_acquire(const char *pidfile);
95void pidfile_write_release(int pid_fd); 95void pidfile_write_release(int pid_fd);
96int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface); 96int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index fd17917d0..4ddd12120 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -20,9 +20,9 @@ struct client_config_t {
20 char release_on_quit; /* perform release on quit */ 20 char release_on_quit; /* perform release on quit */
21 char abort_if_no_lease; /* Abort if no lease */ 21 char abort_if_no_lease; /* Abort if no lease */
22 char background_if_no_lease; /* Fork to background if no lease */ 22 char background_if_no_lease; /* Fork to background if no lease */
23 char *interface; /* The name of the interface to use */ 23 const char *interface; /* The name of the interface to use */
24 char *pidfile; /* Optionally store the process ID */ 24 char *pidfile; /* Optionally store the process ID */
25 char *script; /* User script to run at dhcp events */ 25 const char *script; /* User script to run at dhcp events */
26 uint8_t *clientid; /* Optional client id to use */ 26 uint8_t *clientid; /* Optional client id to use */
27 uint8_t *vendorclass; /* Optional vendor class-id to use */ 27 uint8_t *vendorclass; /* Optional vendor class-id to use */
28 uint8_t *hostname; /* Optional hostname to use */ 28 uint8_t *hostname; /* Optional hostname to use */
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 07f68362c..d2b0bb05b 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -35,7 +35,7 @@ static inline int upper_length(int length, int opt_index)
35} 35}
36 36
37 37
38static int sprintip(char *dest, char *pre, uint8_t *ip) 38static int sprintip(char *dest, const char *pre, const uint8_t *ip)
39{ 39{
40 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]); 40 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]);
41} 41}
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 76ae7172d..d294fb259 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -37,7 +37,7 @@
37#include "common.h" 37#include "common.h"
38 38
39 39
40int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) 40int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
41{ 41{
42 int fd; 42 int fd;
43 struct ifreq ifr; 43 struct ifreq ifr;
@@ -88,7 +88,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
88} 88}
89 89
90 90
91int listen_socket(uint32_t ip, int port, char *inf) 91int listen_socket(uint32_t ip, int port, const char *inf)
92{ 92{
93 struct ifreq interface; 93 struct ifreq interface;
94 int fd; 94 int fd;
diff --git a/networking/wget.c b/networking/wget.c
index 224e80dc0..7766bde88 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -26,7 +26,7 @@ struct host_info {
26static void parse_url(char *url, struct host_info *h); 26static void parse_url(char *url, struct host_info *h);
27static FILE *open_socket(len_and_sockaddr *lsa); 27static FILE *open_socket(len_and_sockaddr *lsa);
28static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); 28static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
29static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf); 29static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf);
30 30
31/* Globals (can be accessed from signal handlers */ 31/* Globals (can be accessed from signal handlers */
32static off_t content_len; /* Content-length of the file */ 32static off_t content_len; /* Content-length of the file */
@@ -37,7 +37,7 @@ static off_t transferred; /* Number of bytes transferred so far */
37static int chunked; /* chunked transfer encoding */ 37static int chunked; /* chunked transfer encoding */
38#if ENABLE_FEATURE_WGET_STATUSBAR 38#if ENABLE_FEATURE_WGET_STATUSBAR
39static void progressmeter(int flag); 39static void progressmeter(int flag);
40static char *curfile; /* Name of current file being transferred */ 40static const char *curfile; /* Name of current file being transferred */
41static struct timeval start; /* Time a transfer started */ 41static struct timeval start; /* Time a transfer started */
42enum { 42enum {
43 STALLTIME = 5 /* Seconds when xfer considered "stalled" */ 43 STALLTIME = 5 /* Seconds when xfer considered "stalled" */
@@ -190,18 +190,18 @@ int wget_main(int argc, char **argv)
190 // Dirty hack. Needed because bb_get_last_path_component 190 // Dirty hack. Needed because bb_get_last_path_component
191 // will destroy trailing / by storing '\0' in last byte! 191 // will destroy trailing / by storing '\0' in last byte!
192 if (!last_char_is(target.path, '/')) { 192 if (!last_char_is(target.path, '/')) {
193 fname_out = 193 fname_out = bb_get_last_path_component(target.path);
194#if ENABLE_FEATURE_WGET_STATUSBAR 194#if ENABLE_FEATURE_WGET_STATUSBAR
195 curfile = 195 curfile = fname_out;
196#endif 196#endif
197 bb_get_last_path_component(target.path);
198 } 197 }
199 if (!fname_out || !fname_out[0]) { 198 if (!fname_out || !fname_out[0]) {
200 fname_out = 199 /* bb_get_last_path_component writes
200 * to last '/' only. We don't have one here... */
201 fname_out = (char*)"index.html";
201#if ENABLE_FEATURE_WGET_STATUSBAR 202#if ENABLE_FEATURE_WGET_STATUSBAR
202 curfile = 203 curfile = fname_out;
203#endif 204#endif
204 "index.html";
205 } 205 }
206 if (dir_prefix != NULL) 206 if (dir_prefix != NULL)
207 fname_out = concat_path_file(dir_prefix, fname_out); 207 fname_out = concat_path_file(dir_prefix, fname_out);
@@ -624,7 +624,7 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
624 return hdrval; 624 return hdrval;
625} 625}
626 626
627static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) 627static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf)
628{ 628{
629 int result; 629 int result;
630 if (s1) { 630 if (s1) {