1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

convert some printError calls to logError

This commit is contained in:
Ben Burdette 2020-05-03 08:01:25 -06:00
parent 4b99c09f5c
commit ab6f0b9641
19 changed files with 195 additions and 70 deletions

View file

@ -39,12 +39,20 @@ std::set<std::string> runResolver(const Path & filename)
throw SysError("statting '%s'", filename);
if (!S_ISREG(st.st_mode)) {
printError("file '%s' is not a regular file", filename);
logError(
ErrorInfo {
.name = "Regular MACH file",
.hint = hintfmt("file '%s' is not a regular file", filename)
});
return {};
}
if (st.st_size < sizeof(mach_header_64)) {
printError("file '%s' is too short for a MACH binary", filename);
logError(
ErrorInfo {
.name = "File too short",
.hint = hintfmt("file '%s' is too short for a MACH binary", filename)
});
return {};
}
@ -66,13 +74,21 @@ std::set<std::string> runResolver(const Path & filename)
}
}
if (mach64_offset == 0) {
printError(format("Could not find any mach64 blobs in file '%1%', continuing...") % filename);
logError(
ErrorInfo {
.name = "No mach64 blobs",
.hint = hintfmt("Could not find any mach64 blobs in file '%1%', continuing...", filename)
});
return {};
}
} else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) {
mach64_offset = 0;
} else {
printError(format("Object file has unknown magic number '%1%', skipping it...") % magic);
logError(
ErrorInfo {
.name = "Magic number",
.hint = hintfmt("Object file has unknown magic number '%1%', skipping it...", magic)
});
return {};
}