diff options
-rw-r--r-- | ldid.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1564,28 +1564,29 @@ int main(int argc, char *argv[]) { size_t filei(0), filee(0); _foreach (file, files) try { const char *path(file.c_str()); - const char *base = strrchr(path, '/'); - - std::string dir; - if (base != NULL) - dir.assign(path, base++ - path + 1); - else - base = path; - - const char *name(flag_I ?: base); std::string temp; if (flag_S || flag_r) { Map input(path, O_RDONLY, PROT_READ, MAP_PRIVATE); + std::string dir; + const char *base = strrchr(path, '/'); + + if (base != NULL) + dir.assign(path, base++ - path + 1); + else + base = path; + temp = dir + "." + base + ".cs"; std::filebuf output; _assert(output.open(temp.c_str(), std::ios::out | std::ios::trunc | std::ios::binary) == &output); if (flag_r) resign(input.data(), input.size(), output); - else + else { + const char *name(flag_I ?: base); resign(input.data(), input.size(), output, name, entitlements, key, slots); + } } Map mapping(!temp.empty() ? temp.c_str() : path, flag_T || flag_s); |