summaryrefslogtreecommitdiff
path: root/networking/netstat.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-29 22:51:25 +0000
committerDenis Vlasenko2007-01-29 22:51:25 +0000
commitb6aae0f38194cd39960a898606ee65d4be93a895 (patch)
treeb73c92aefaf614291a71d05e9d28ca68f4ef021b /networking/netstat.c
parenta41fdf331af344ecd3ec230a072857ea197e1890 (diff)
downloadbusybox-b6aae0f38194cd39960a898606ee65d4be93a895.zip
busybox-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz
preparatory patch for -Wwrite-strings #2
Diffstat (limited to 'networking/netstat.c')
-rw-r--r--networking/netstat.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/networking/netstat.c b/networking/netstat.c
index 16ee52d..a5631c3 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;