Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ranlib (libtool) can't rename file #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cctools/libstuff/ofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ struct ofile *ofile)
my_mach_error(r, "Can't vm_deallocate mapped memory for file: "
"%s", ofile->file_name);
}
munmap(ofile->file_addr, ofile->file_size);
}
if(ofile->file_name != NULL)
free(ofile->file_name);
Expand Down
13 changes: 10 additions & 3 deletions cctools/misc/libtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3172,10 +3172,17 @@ struct ofile *ofile)
* Move the temporary file into its final location
*/
if (tempfile) {
/*
* Must release mmap otherwise rename will fail on non-local fs.
* NB: the ofile_unmap can be made by caller as well
*/
if (ofile) {
ofile_unmap(ofile);
}
if (rename(tempfile, output)) {
system_fatal("can't move the output file to its final location: %s",
output);
return;
system_fatal("can't move the output file to its final location: %s",
output);
return;
}
}
}
Expand Down