summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds/idmap2/idmap2d/Idmap2Service.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp
index 05336baf9217..4f775aa52195 100644
--- a/cmds/idmap2/idmap2d/Idmap2Service.cpp
+++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp
@@ -262,17 +262,17 @@ Status Idmap2Service::createFabricatedOverlay(
path.c_str(), uid));
}
+ const auto frro = builder.Build();
+ if (!frro) {
+ return error(StringPrintf("failed to serialize '%s:%s': %s", overlay.packageName.c_str(),
+ overlay.overlayName.c_str(), frro.GetErrorMessage().c_str()));
+ }
// Persist the fabricated overlay.
umask(kIdmapFilePermissionMask);
std::ofstream fout(path);
if (fout.fail()) {
return error("failed to open frro path " + path);
}
- const auto frro = builder.Build();
- if (!frro) {
- return error(StringPrintf("failed to serialize '%s:%s': %s", overlay.packageName.c_str(),
- overlay.overlayName.c_str(), frro.GetErrorMessage().c_str()));
- }
auto result = frro->ToBinaryStream(fout);
if (!result) {
unlink(path.c_str());