diff options
author | Denis Vlasenko | 2007-01-29 22:51:58 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-29 22:51:58 +0000 |
commit | ab2aea44479fd6f519bccd651a37f30e792b7593 (patch) | |
tree | 443636e12ffb52db95168013bbda80f78ed49fe6 /networking/libiproute | |
parent | 06c0a71d2315756db874e98bc4f760ca3283b6a6 (diff) | |
download | busybox-ab2aea44479fd6f519bccd651a37f30e792b7593.zip busybox-ab2aea44479fd6f519bccd651a37f30e792b7593.tar.gz |
preparatory patch for -Wwrite-strings #4
Diffstat (limited to 'networking/libiproute')
-rw-r--r-- | networking/libiproute/iptunnel.c | 6 | ||||
-rw-r--r-- | networking/libiproute/rt_names.c | 11 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 20 | ||||
-rw-r--r-- | networking/libiproute/utils.h | 6 |
4 files changed, 20 insertions, 23 deletions
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index a67803f..e2e75fc 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -85,7 +85,7 @@ static char *do_ioctl_get_ifname(int idx) -static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p) +static int do_get_ioctl(const char *basedev, struct ip_tunnel_parm *p) { struct ifreq ifr; int fd; @@ -102,7 +102,7 @@ static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p) return err; } -static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p) +static int do_add_ioctl(int cmd, const char *basedev, struct ip_tunnel_parm *p) { struct ifreq ifr; int fd; @@ -123,7 +123,7 @@ static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p) return err; } -static int do_del_ioctl(char *basedev, struct ip_tunnel_parm *p) +static int do_del_ioctl(const char *basedev, struct ip_tunnel_parm *p) { struct ifreq ifr; int fd; diff --git a/networking/libiproute/rt_names.c b/networking/libiproute/rt_names.c index 686326f..797c83b 100644 --- a/networking/libiproute/rt_names.c +++ b/networking/libiproute/rt_names.c @@ -13,7 +13,7 @@ #include "libbb.h" #include "rt_names.h" -static void rtnl_tab_initialize(char *file, const char **tab, int size) +static void rtnl_tab_initialize(const char *file, const char **tab, int size) { char buf[512]; FILE *fp; @@ -30,10 +30,11 @@ static void rtnl_tab_initialize(char *file, const char **tab, int size) p++; if (*p == '#' || *p == '\n' || *p == 0) continue; - if (sscanf(p, "0x%x %s\n", &id, namebuf) != 2 && - sscanf(p, "0x%x %s #", &id, namebuf) != 2 && - sscanf(p, "%d %s\n", &id, namebuf) != 2 && - sscanf(p, "%d %s #", &id, namebuf) != 2) { + if (sscanf(p, "0x%x %s\n", &id, namebuf) != 2 + && sscanf(p, "0x%x %s #", &id, namebuf) != 2 + && sscanf(p, "%d %s\n", &id, namebuf) != 2 + && sscanf(p, "%d %s #", &id, namebuf) != 2 + ) { bb_error_msg("database %s is corrupted at %s", file, p); return; diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index 5e06656..591c893 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -178,7 +178,7 @@ int get_prefix_1(inet_prefix * dst, char *arg, int family) slash = strchr(arg, '/'); if (slash) - *slash = 0; + *slash = '\0'; err = get_addr_1(dst, arg, family); if (err == 0) { switch (dst->family) { @@ -237,26 +237,22 @@ uint32_t get_addr32(char *name) void incomplete_command(void) { - bb_error_msg("command line is not complete, try option \"help\""); - exit(-1); + bb_error_msg_and_die("command line is not complete, try option \"help\""); } -void invarg(const char * const arg, const char * const opt) +void invarg(const char *arg, const char *opt) { - bb_error_msg(bb_msg_invalid_arg, arg, opt); - exit(-1); + bb_error_msg_and_die(bb_msg_invalid_arg, arg, opt); } -void duparg(char *key, char *arg) +void duparg(const char *key, const char *arg) { - bb_error_msg("duplicate \"%s\": \"%s\" is the second value", key, arg); - exit(-1); + bb_error_msg_and_die("duplicate \"%s\": \"%s\" is the second value", key, arg); } -void duparg2(char *key, char *arg) +void duparg2(const char *key, const char *arg) { - bb_error_msg("either \"%s\" is duplicate, or \"%s\" is garbage", key, arg); - exit(-1); + bb_error_msg_and_die("either \"%s\" is duplicate, or \"%s\" is garbage", key, arg); } int matches(const char *cmd, const char *pattern) diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 5af8ba7..ebf2af1 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h @@ -75,9 +75,9 @@ extern int get_s8(int8_t *val, char *arg, int base); extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); -void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN; -void duparg(char *, char *) ATTRIBUTE_NORETURN; -void duparg2(char *, char *) ATTRIBUTE_NORETURN; +void invarg(const char *, const char *) ATTRIBUTE_NORETURN; +void duparg(const char *, const char *) ATTRIBUTE_NORETURN; +void duparg2(const char *, const char *) ATTRIBUTE_NORETURN; int matches(const char *arg, const char *pattern); extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits); |