@@ -424,7 +424,7 @@ ssize_t pread_all(int fd, void *buf, size_t count, off_t offset)
424
424
425
425
template <typename T>
426
426
int parse_macho (int fd, uint32_t offset, uint32_t size,
427
- void (^dylibVisitor)(std::filesystem::path const &path),
427
+ void (^dylibVisitor)(std::filesystem::path const &path),
428
428
void (^uuidVisitor)(uuid_t const uuid))
429
429
{
430
430
ssize_t readed;
@@ -681,7 +681,7 @@ std::vector<uint8_t> readToEOF(int fd) {
681
681
}
682
682
683
683
// Runs a tool with `xcrun`.
684
- // Returns NSTask.terminationStatus .
684
+ // Returns the tool's termination status .
685
685
// Prints the tool's command line if we are verbose.
686
686
// Prints the tool's stdout and stderr if terminationStatus is non-zero
687
687
// or if we are very verbose.
@@ -745,6 +745,7 @@ int xcrunToolCommand(std::vector<std::string> commandAndArguments, XcrunToolBloc
745
745
746
746
int status = 0 ;
747
747
waitpid (childPid, &status, 0 );
748
+ status = WIFSIGNALED (status) ? WTERMSIG (status) : (WIFEXITED (status) ? WEXITSTATUS (status) : 0 );
748
749
749
750
// Task is finished and we have its stdout and stderr output.
750
751
@@ -780,7 +781,7 @@ copyFile(std::filesystem::path src, std::filesystem::path dst, bool stripBitcode
780
781
if (stripBitcode) {
781
782
copyAndStripBitcode (src, dst);
782
783
} else {
783
- if (rename (src. c_str () , dst. c_str ()) != 0 ) {
784
+ if (! std::filesystem::copy_file (src, dst) ) {
784
785
fail (" Couldn't copy %s to %s: %s" , src.c_str (), dst.c_str (), strerror (errno));
785
786
}
786
787
}
@@ -1019,7 +1020,7 @@ int main(int argc, const char *argv[])
1019
1020
worklist.push_back (lib);
1020
1021
}
1021
1022
while (worklist.size ()) {
1022
- auto const & lib = worklist.back ();
1023
+ auto const lib = worklist.back ();
1023
1024
worklist.pop_back ();
1024
1025
auto const path = src_dir/lib;
1025
1026
process (path,
@@ -1054,7 +1055,7 @@ int main(int argc, const char *argv[])
1054
1055
worklist.push_back (lib);
1055
1056
}
1056
1057
while (worklist.size ()) {
1057
- auto const & lib = worklist.back ();
1058
+ auto const lib = worklist.back ();
1058
1059
worklist.pop_back ();
1059
1060
auto const path = src_dir/lib;
1060
1061
process (path,
@@ -1150,7 +1151,7 @@ int main(int argc, const char *argv[])
1150
1151
1151
1152
// Other codesign flags come later
1152
1153
// so they can override the default flags.
1153
- std::move (otherCodesignFlags.begin (), otherCodesignFlags.end (),
1154
+ std::copy (otherCodesignFlags.begin (), otherCodesignFlags.end (),
1154
1155
std::back_inserter (commandAndArguments));
1155
1156
1156
1157
commandAndArguments.push_back (dst);
0 commit comments