diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:25 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:25 +0000 |
commit | b6aae0f38194cd39960a898606ee65d4be93a895 (patch) | |
tree | b73c92aefaf614291a71d05e9d28ca68f4ef021b /networking | |
parent | a41fdf331af344ecd3ec230a072857ea197e1890 (diff) | |
download | busybox-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz |
preparatory patch for -Wwrite-strings #2
Diffstat (limited to 'networking')
-rw-r--r-- | networking/arping.c | 2 | ||||
-rw-r--r-- | networking/ftpgetput.c | 4 | ||||
-rw-r--r-- | networking/inetd.c | 2 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 2 | ||||
-rw-r--r-- | networking/libiproute/utils.h | 5 | ||||
-rw-r--r-- | networking/netstat.c | 14 | ||||
-rw-r--r-- | networking/route.c | 2 | ||||
-rw-r--r-- | networking/telnet.c | 2 | ||||
-rw-r--r-- | networking/udhcp/common.h | 4 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 4 | ||||
-rw-r--r-- | networking/udhcp/script.c | 2 | ||||
-rw-r--r-- | networking/udhcp/socket.c | 4 | ||||
-rw-r--r-- | networking/wget.c | 18 |
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) int arping_main(int argc, char **argv) { - char *device = "eth0"; + const char *device = "eth0"; int ifindex; char *source = NULL; 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 @@ #include <getopt.h> typedef struct ftp_host_info_s { - char *user; - char *password; + const char *user; + const char *password; struct len_and_sockaddr *lsa; } ftp_host_info_t; 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; static struct servent *sp; static uid_t uid; -static char *CONFIG = _PATH_INETDCONF; +static const char *CONFIG = _PATH_INETDCONF; static FILE *fconfig; static 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) exit(-1); } -int matches(char *cmd, char *pattern) +int matches(const char *cmd, const char *pattern) { int len = strlen(cmd); 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 #define AF_DECnet 12 #endif -struct dn_naddr -{ +struct dn_naddr { unsigned short a_len; unsigned char a_addr[DN_MAXADDL]; }; @@ -79,7 +78,7 @@ extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int bufle void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN; void duparg(char *, char *) ATTRIBUTE_NORETURN; void duparg2(char *, char *) ATTRIBUTE_NORETURN; -int matches(char *arg, char *pattern); +int matches(const char *arg, const char *pattern); extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits); const 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 { #define SO_WAITDATA (1<<17) /* wait data to read */ #define SO_NOSPACE (1<<18) /* no space to write */ -static char *get_sname(int port, const char *proto, int num) +static const char *get_sname(int port, const char *proto, int num) { - char *str = itoa(ntohs(port)); + /* hummm, we return static buffer here!! */ + const char *str = itoa(ntohs(port)); if (!num) { struct servent *se = getservbyport(port, proto); if (se) @@ -82,9 +83,9 @@ static char *get_sname(int port, const char *proto, int num) return str; } -static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, char *proto, int numeric) +static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, const char *proto, int numeric) { - char *port_name; + const char *port_name; #if ENABLE_FEATURE_IPV6 if (addr->sa_family == AF_INET6) { @@ -178,7 +179,8 @@ static void tcp_do_one(int lnr, const char *line) static void udp_do_one(int lnr, const char *line) { char local_addr[64], rem_addr[64]; - char *state_str, more[512]; + const char *state_str; + char more[512]; int num, local_port, rem_port, d, state, timer_run, uid, timeout; #if ENABLE_FEATURE_IPV6 struct sockaddr_in6 localaddr, remaddr; @@ -356,7 +358,7 @@ static void unix_do_one(int nr, const char *line) { static int has = 0; char path[PATH_MAX], ss_flags[32]; - char *ss_proto, *ss_state, *ss_type; + const char *ss_proto, *ss_state, *ss_type; int num, state, type, inode; void *d; 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) #ifdef RTF_REJECT if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) { - rt.rt_dev = "lo"; + rt.rt_dev = (char*)"lo"; } #endif 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) static void putiac_subopt_autologin(void) { int len = strlen(autologin) + 6; // (2 + 1 + 1 + strlen + 2) - char *user = "USER"; + const char *user = "USER"; if (G.iaclen + len > IACBUFSIZE) 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); int udhcp_sp_fd_set(fd_set *rfds, int extra_fd); int udhcp_sp_read(fd_set *rfds); int raw_socket(int ifindex); -int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp); -int listen_socket(uint32_t ip, int port, char *inf); +int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp); +int listen_socket(uint32_t ip, int port, const char *inf); int pidfile_acquire(const char *pidfile); void pidfile_write_release(int pid_fd); int 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 { char release_on_quit; /* perform release on quit */ char abort_if_no_lease; /* Abort if no lease */ char background_if_no_lease; /* Fork to background if no lease */ - char *interface; /* The name of the interface to use */ + const char *interface; /* The name of the interface to use */ char *pidfile; /* Optionally store the process ID */ - char *script; /* User script to run at dhcp events */ + const char *script; /* User script to run at dhcp events */ uint8_t *clientid; /* Optional client id to use */ uint8_t *vendorclass; /* Optional vendor class-id to use */ 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) } -static int sprintip(char *dest, char *pre, uint8_t *ip) +static int sprintip(char *dest, const char *pre, const uint8_t *ip) { return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]); } 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 @@ #include "common.h" -int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) +int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) { int fd; struct ifreq ifr; @@ -88,7 +88,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) } -int listen_socket(uint32_t ip, int port, char *inf) +int listen_socket(uint32_t ip, int port, const char *inf) { struct ifreq interface; 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 { static void parse_url(char *url, struct host_info *h); static FILE *open_socket(len_and_sockaddr *lsa); static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); -static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf); +static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf); /* Globals (can be accessed from signal handlers */ static off_t content_len; /* Content-length of the file */ @@ -37,7 +37,7 @@ static off_t transferred; /* Number of bytes transferred so far */ static int chunked; /* chunked transfer encoding */ #if ENABLE_FEATURE_WGET_STATUSBAR static void progressmeter(int flag); -static char *curfile; /* Name of current file being transferred */ +static const char *curfile; /* Name of current file being transferred */ static struct timeval start; /* Time a transfer started */ enum { STALLTIME = 5 /* Seconds when xfer considered "stalled" */ @@ -190,18 +190,18 @@ int wget_main(int argc, char **argv) // Dirty hack. Needed because bb_get_last_path_component // will destroy trailing / by storing '\0' in last byte! if (!last_char_is(target.path, '/')) { - fname_out = + fname_out = bb_get_last_path_component(target.path); #if ENABLE_FEATURE_WGET_STATUSBAR - curfile = + curfile = fname_out; #endif - bb_get_last_path_component(target.path); } if (!fname_out || !fname_out[0]) { - fname_out = + /* bb_get_last_path_component writes + * to last '/' only. We don't have one here... */ + fname_out = (char*)"index.html"; #if ENABLE_FEATURE_WGET_STATUSBAR - curfile = + curfile = fname_out; #endif - "index.html"; } if (dir_prefix != NULL) 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) return hdrval; } -static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) +static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf) { int result; if (s1) { |