Commit 4ffc44ca authored by Yu Zhiguo's avatar Yu Zhiguo Committed by Stephen Hemminger

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: default avatarYu Zhiguo <yuzg@cn.fujitsu.com>
parent 3cc6232e
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment