From 9c4100c729bfe7f8792f7da38666fb07642d6c3e Mon Sep 17 00:00:00 2001 From: Alex Brachet Date: Fri, 5 Jul 2019 01:28:41 +0000 Subject: [PATCH] Fix patch not passing test cases 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 | 7 +++---- tools/llvm-objcopy/llvm-objcopy.cpp | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/tools/llvm-objcopy/ELF/respect-umask.test b/test/tools/llvm-objcopy/ELF/respect-umask.test index b7652850f4b..e6f06b75060 100644 --- a/test/tools/llvm-objcopy/ELF/respect-umask.test +++ b/test/tools/llvm-objcopy/ELF/respect-umask.test @@ -19,20 +19,19 @@ # 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: diff --git a/tools/llvm-objcopy/llvm-objcopy.cpp b/tools/llvm-objcopy/llvm-objcopy.cpp index db5609ea229..d04b1cf462f 100644 --- a/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/tools/llvm-objcopy/llvm-objcopy.cpp @@ -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)) -- 2.40.0