mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
perf test sdt: Handle realpath() failure
It can return NULL, in which case we should bail out and remove the
directory created with mkdtemp(), which is stored in the "__tempdir"
variable, not in "tempdir".
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 8e5dc84835
("perf test: Add a test case for SDT event")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4b4cd50319
commit
8526bafc14
1 changed files with 3 additions and 1 deletions
|
@ -83,6 +83,8 @@ int test__sdt_event(int subtests __maybe_unused)
|
|||
}
|
||||
/* Note that buildid_dir must be an absolute path */
|
||||
tempdir = realpath(__tempdir, NULL);
|
||||
if (tempdir == NULL)
|
||||
goto error_rmdir;
|
||||
|
||||
/* At first, scan itself */
|
||||
set_buildid_dir(tempdir);
|
||||
|
@ -100,7 +102,7 @@ int test__sdt_event(int subtests __maybe_unused)
|
|||
|
||||
error_rmdir:
|
||||
/* Cleanup temporary buildid dir */
|
||||
rm_rf(tempdir);
|
||||
rm_rf(__tempdir);
|
||||
error:
|
||||
free(tempdir);
|
||||
free(myself);
|
||||
|
|
Loading…
Reference in a new issue