/*
* The shared cache must both contain the magic ID and
* match the uuid we discovered via dyld's information.
+ * Assumes that the dyld_cache_header grows in a binary compatible fashion.
*/
bool
get_uuid_from_shared_cache_mapping(const void *addr, size_t size, uuid_t out)
const struct copied_dyld_cache_header *ch = addr;
if (size < sizeof (*ch))
return false;
- static const char prefix[] = "dyld_v1 ";
+ static const char prefix[] = "dyld_v";
if (strncmp(ch->magic, prefix, strlen(prefix)) != 0)
return false;
uuid_copy(out, ch->uuid);
int d = open(fe->fts_accpath, O_RDONLY);
if (-1 == d) {
- if (opt->debug)
+ if (OPTIONS_DEBUG(opt, 1))
printf("%s: cannot open - %s\n", fe->fts_accpath, strerror(errno));
continue;
}
void *addr = mmap(NULL, dyld_cache_header_size, PROT_READ, MAP_PRIVATE, d, 0);
close(d);
if ((void *)-1 == addr) {
- if (opt->debug)
+ if (OPTIONS_DEBUG(opt, 1))
printf("%s: cannot mmap - %s\n", fe->fts_accpath, strerror(errno));
continue;
}
if (get_uuid_from_shared_cache_mapping(addr, dyld_cache_header_size, scuuid)) {
if (uuid_compare(uu, scuuid) == 0)
nm = strdup(fe->fts_accpath);
- else if (opt->debug) {
+ else if (OPTIONS_DEBUG(opt, 3)) {
uuid_string_t scstr;
uuid_unparse_lower(scuuid, scstr);
printf("%s: shared cache mismatch (%s)\n", fe->fts_accpath, scstr);