aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/iproute.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 23:43:18 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 23:43:18 +0000
commit89ef65f02463b27313ff0eba806aa6e4aec10716 (patch)
tree70eab3e72843b1418ef3d88437c1f1a19169bda8 /networking/libiproute/iproute.c
parentab2aea44479fd6f519bccd651a37f30e792b7593 (diff)
downloadbusybox-89ef65f02463b27313ff0eba806aa6e4aec10716.tar.gz
preparatory patch for -Wwrite-strings #5
Diffstat (limited to 'networking/libiproute/iproute.c')
-rw-r--r--networking/libiproute/iproute.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index c8a58c11c..27d37ac79 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -469,21 +469,15 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family)
static int iproute_flush_cache(void)
{
-#define ROUTE_FLUSH_PATH "/proc/sys/net/ipv4/route/flush"
-
- int len;
- int flush_fd = open (ROUTE_FLUSH_PATH, O_WRONLY);
- char *buffer = "-1";
-
+ static const char fn[] = "/proc/sys/net/ipv4/route/flush";
+ int flush_fd = open(fn, O_WRONLY);
if (flush_fd < 0) {
- fprintf(stderr, "Cannot open \"%s\"\n", ROUTE_FLUSH_PATH);
+ bb_perror_msg("cannot open '%s'", fn);
return -1;
}
- len = strlen (buffer);
-
- if ((write (flush_fd, (void *)buffer, len)) < len) {
- fprintf(stderr, "Cannot flush routing cache\n");
+ if (write(flush_fd, "-1", 2) < 2) {
+ bb_perror_msg("cannot flush routing cache");
return -1;
}
close(flush_fd);