summaryrefslogtreecommitdiff
path: root/tools/llvm-ar/llvm-ar.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-19 19:17:15 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-19 19:17:15 +0000
commit27ff1f3f7d9a20e02e00fe88dbb7541ce066d33c (patch)
tree974fbacb7d720dcf11a05276468ab5f10a531eeb /tools/llvm-ar/llvm-ar.cpp
parent13f4fd77b96c39b3836d1186953003ddfea3a646 (diff)
downloadllvm-27ff1f3f7d9a20e02e00fe88dbb7541ce066d33c.tar.gz
llvm-27ff1f3f7d9a20e02e00fe88dbb7541ce066d33c.tar.bz2
llvm-27ff1f3f7d9a20e02e00fe88dbb7541ce066d33c.tar.xz
Always set the mode.
This matches GNU ar behavior. Also remove the now unused getFileStatus method. Not sure how to add a test, it would have to run ls -l or something like that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ar/llvm-ar.cpp')
-rw-r--r--tools/llvm-ar/llvm-ar.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 4061551411..03bb36b116 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -440,12 +440,18 @@ doExtract(std::string* ErrMsg) {
file.write(data,len);
file.close();
+ sys::PathWithStatus PWS(I->getPath());
+ sys::FileStatus Status = *PWS.getFileStatus();
+
+ // Retain the original mode.
+ Status.mode = I->getMode();
+
// If we're supposed to retain the original modification times, etc. do so
// now.
- if (OriginalDates) {
- sys::PathWithStatus PWS(I->getPath());
- PWS.setStatusInfoOnDisk(I->getFileStatus());
- }
+ if (OriginalDates)
+ Status.modTime = I->getModTime();
+
+ PWS.setStatusInfoOnDisk(Status);
}
}
return false;