Messages in this thread Patch in this message | | | From | Namhyung Kim <> | Subject | [PATCH 2/2] perf tools: Check validity of --symfs value | Date | Fri, 25 Jul 2014 10:31:48 +0900 |
| |
If a symfs is given by user, it needs to be checked before applying. Currently, it just uses it even if realpath() failed.
I guess it's because it needed to handle empty symfs which is the default value. But now it's only called when it's not empty so it'd be better to check before using it and warn users if failed.
Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/util/symbol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 90723a12e947..95186185c1d5 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1864,8 +1864,11 @@ int symbol__init(void) if (*symbol_conf.symfs) { symfs = realpath(symbol_conf.symfs, NULL); - if (symfs == NULL) - symfs = (char *)symbol_conf.symfs; + if (symfs == NULL) { + pr_err("cannot apply symfs: %s: %s\n", + symbol_conf.symfs, strerror(errno)); + return -1; + } /* * A path to symbols of "/" is identical to "" -- 2.0.0
| |