]> granicus.if.org Git - llvm/commitdiff
Fix patch not passing test cases
authorAlex Brachet <alexbrachetmialot@gmail.com>
Fri, 5 Jul 2019 01:28:41 +0000 (01:28 +0000)
committerAlex Brachet <alexbrachetmialot@gmail.com>
Fri, 5 Jul 2019 01:28:41 +0000 (01:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365170 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objcopy/ELF/respect-umask.test
tools/llvm-objcopy/llvm-objcopy.cpp

index b7652850f4b9bfd2a74c09ea6987f48998149a0e..e6f06b7506013c1b0f710cbf4cee496d7e5ca501 100644 (file)
 # RUN: chmod 0777 %t
 # RUN: llvm-objcopy %t %t1
 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
-##   : cmp %t1.perms %t.0755
+# RUN: cmp %t1.perms %t.0755
 
 # RUN: umask 0237
 # RUN: chmod 0707 %t
 # RUN: llvm-objcopy %t %t1
 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
-##   : cmp %t1.perms %t.0500
+# RUN: cmp %t1.perms %t.0500
 
 # RUN: umask 0222
 # RUN: chmod 0777 %t
 # RUN: llvm-objcopy %t %t1
 # RUN: ls -l %t1 | cut -f 1 -d ' ' > %t1.perms
-##   : cmp %t1.perms %t.0555
-
+# RUN: cmp %t1.perms %t.0555
 
 --- !ELF
 FileHeader:
index db5609ea2294c2d4142ffc1b4cd07a13b69d5ff8..d04b1cf462f356f3f186025cfe5101db8ca4ad69 100644 (file)
@@ -215,7 +215,8 @@ static Error restoreStatOnFile(StringRef Filename,
             FD, Stat.getLastAccessedTime(), Stat.getLastModificationTime()))
       return createFileError(Filename, EC);
 
-  if (auto EC = sys::fs::setPermissions(Filename, Stat.permissions()))
+  if (auto EC = sys::fs::setPermissions(Filename, Stat.permissions(),
+                                        /*respectUmask=*/true))
     return createFileError(Filename, EC);
 
   if (auto EC = sys::Process::SafelyCloseFileDescriptor(FD))