Eliminate the last user of basename_r() in the base system.

In this case it's fairly easy to make use of basename().
This commit is contained in:
Ed Schouten 2017-12-01 10:25:52 +00:00
parent d8ba1ddc0f
commit 1bf4012c84
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326423

View File

@ -105,7 +105,7 @@ static void
verify_bkpt(struct proc_handle *phdl, GElf_Sym *sym, const char *symname, verify_bkpt(struct proc_handle *phdl, GElf_Sym *sym, const char *symname,
const char *mapname) const char *mapname)
{ {
char mapbname[MAXPATHLEN], *name; char *name, *mapname_copy, *mapbname;
GElf_Sym tsym; GElf_Sym tsym;
prmap_t *map; prmap_t *map;
size_t namesz; size_t namesz;
@ -147,9 +147,11 @@ verify_bkpt(struct proc_handle *phdl, GElf_Sym *sym, const char *symname,
map = proc_addr2map(phdl, addr); map = proc_addr2map(phdl, addr);
ATF_REQUIRE_MSG(map != NULL, "failed to look up map for address 0x%lx", ATF_REQUIRE_MSG(map != NULL, "failed to look up map for address 0x%lx",
addr); addr);
basename_r(map->pr_mapname, mapbname); mapname_copy = strdup(map->pr_mapname);
mapbname = basename(mapname_copy);
ATF_REQUIRE_EQ_MSG(strcmp(mapname, mapbname), 0, ATF_REQUIRE_EQ_MSG(strcmp(mapname, mapbname), 0,
"expected map name '%s' doesn't match '%s'", mapname, mapbname); "expected map name '%s' doesn't match '%s'", mapname, mapbname);
free(mapname_copy);
} }
ATF_TC(map_alias_name2map); ATF_TC(map_alias_name2map);