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 <yuzg@cn.fujitsu.com>
This commit is contained in:
Yu Zhiguo 2008-06-20 09:50:16 +08:00 committed by Stephen Hemminger
parent 3cc6232e08
commit 4ffc44ca7c
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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)