@@ -424,7 +424,7 @@ ssize_t pread_all(int fd, void *buf, size_t count, off_t offset)
424424
425425template <typename T>
426426int 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),
428428 void (^uuidVisitor)(uuid_t const uuid))
429429{
430430 ssize_t readed;
@@ -681,7 +681,7 @@ std::vector<uint8_t> readToEOF(int fd) {
681681}
682682
683683// Runs a tool with `xcrun`.
684- // Returns NSTask.terminationStatus .
684+ // Returns the tool's termination status .
685685// Prints the tool's command line if we are verbose.
686686// Prints the tool's stdout and stderr if terminationStatus is non-zero
687687// or if we are very verbose.
@@ -745,6 +745,7 @@ int xcrunToolCommand(std::vector<std::string> commandAndArguments, XcrunToolBloc
745745
746746 int status = 0 ;
747747 waitpid (childPid, &status, 0 );
748+ status = WIFSIGNALED (status) ? WTERMSIG (status) : (WIFEXITED (status) ? WEXITSTATUS (status) : 0 );
748749
749750 // Task is finished and we have its stdout and stderr output.
750751
@@ -780,7 +781,7 @@ copyFile(std::filesystem::path src, std::filesystem::path dst, bool stripBitcode
780781 if (stripBitcode) {
781782 copyAndStripBitcode (src, dst);
782783 } else {
783- if (rename (src. c_str () , dst. c_str ()) != 0 ) {
784+ if (! std::filesystem::copy_file (src, dst) ) {
784785 fail (" Couldn't copy %s to %s: %s" , src.c_str (), dst.c_str (), strerror (errno));
785786 }
786787 }
@@ -1019,7 +1020,7 @@ int main(int argc, const char *argv[])
10191020 worklist.push_back (lib);
10201021 }
10211022 while (worklist.size ()) {
1022- auto const & lib = worklist.back ();
1023+ auto const lib = worklist.back ();
10231024 worklist.pop_back ();
10241025 auto const path = src_dir/lib;
10251026 process (path,
@@ -1054,7 +1055,7 @@ int main(int argc, const char *argv[])
10541055 worklist.push_back (lib);
10551056 }
10561057 while (worklist.size ()) {
1057- auto const & lib = worklist.back ();
1058+ auto const lib = worklist.back ();
10581059 worklist.pop_back ();
10591060 auto const path = src_dir/lib;
10601061 process (path,
@@ -1150,7 +1151,7 @@ int main(int argc, const char *argv[])
11501151
11511152 // Other codesign flags come later
11521153 // so they can override the default flags.
1153- std::move (otherCodesignFlags.begin (), otherCodesignFlags.end (),
1154+ std::copy (otherCodesignFlags.begin (), otherCodesignFlags.end (),
11541155 std::back_inserter (commandAndArguments));
11551156
11561157 commandAndArguments.push_back (dst);
0 commit comments