From: Yu Zhiguo Date: Fri, 20 Jun 2008 01:50:16 +0000 (+0800) Subject: Fix generic_proc_open() of command 'nstat' and 'rtacct' X-Git-Tag: v2.6.26~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ffc44ca7c1ec7adb980b67ae1e1c8fa772777f1;p=thirdparty%2Fiproute2.git Fix generic_proc_open() of command 'nstat' and 'rtacct' Fix a bug of generic_proc_open(), so environment variables (e.g. PROC_NET_SNMP, PROC_NET_RTACCT) can be used to specify procfile. Signed-off-by: Yu Zhiguo --- diff --git a/misc/nstat.c b/misc/nstat.c index 228bce22a..80e695fca 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -43,7 +43,7 @@ int npatterns; char info_source[128]; int source_mismatch; -int generic_proc_open(char *env, char *name) +static int generic_proc_open(const char *env, char *name) { char store[128]; char *p = getenv(env); @@ -52,7 +52,7 @@ int generic_proc_open(char *env, char *name) snprintf(store, sizeof(store)-1, "%s/%s", p, name); p = store; } - return open(store, O_RDONLY); + return open(p, O_RDONLY); } int net_netstat_open(void) diff --git a/misc/rtacct.c b/misc/rtacct.c index e6399d00d..eb3ea9ecf 100644 --- a/misc/rtacct.c +++ b/misc/rtacct.c @@ -43,7 +43,7 @@ int dump_zeros = 0; unsigned long magic_number = 0; double W; -int generic_proc_open(char *env, char *name) +static int generic_proc_open(const char *env, const char *name) { char store[1024]; char *p = getenv(env); @@ -52,7 +52,7 @@ int generic_proc_open(char *env, char *name) snprintf(store, sizeof(store)-1, "%s/%s", p, name); p = store; } - return open(store, O_RDONLY); + return open(p, O_RDONLY); } int net_rtacct_open(void)