sysctl: enable pattern matching with path

Pattern matching support in `sysctl: implement --pattern option'
commit did not work when variable path was defined, for example

$ sysctl net.ipv4 -r arp.ignore

gave no output. Reason being was tht the pattern was matched agains
the specified argument and not the output variable list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-12-18 16:24:36 +01:00
parent 5862f47b96
commit a10282422b

View File

@ -164,11 +164,6 @@ static int ReadSetting(const char *restrict const name) {
outname = xstrdup(name);
slashdot(outname,'/','.'); /* change / to . */
if (pattern && !pattern_match(outname, pattern)){
free(outname);
return 0;
}
/* used to open the file */
tmpname = xmalloc(strlen(name)+strlen(PROC_PATH)+2);
strcpy(tmpname, PROC_PATH);
@ -198,6 +193,11 @@ static int ReadSetting(const char *restrict const name) {
goto out;
}
if (pattern && !pattern_match(outname, pattern)){
free(outname);
return 0;
}
fp = fopen(tmpname, "r");
if (!fp) {