llvm-project/llvm/lib/Support/Windows
Fangrui Song 6dc5962957 [llvm-objcopy] Don't change permissions of non-regular output files
There is currently an EPERM error when a regular user executes `llvm-objcopy a.o /dev/null`.
Worse, root can even change the mode bits of /dev/null.

Fix it by checking if the output file is special.

A new overload of llvm::sys::fs::setPermissions with FD as the parameter
is added. Users should provide `perm & ~umask` as the parameter if they
intend to respect umask.

The existing overload of llvm::sys::fs::setPermissions may be deleted if
we can find an implementation of fchmod() on Windows. fchmod() is
usually better than chmod() because it saves syscalls and can avoid race
condition.

Reviewed By: jakehehrlich, jhenderson

Differential Revision: https://reviews.llvm.org/D64236

llvm-svn: 365753
2019-07-11 10:17:59 +00:00
..
COM.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DynamicLibrary.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Host.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Memory.inc [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock. 2019-05-20 20:53:05 +00:00
Mutex.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Path.inc [llvm-objcopy] Don't change permissions of non-regular output files 2019-07-11 10:17:59 +00:00
Process.inc [Support] Add error handling to sys::Process::getPageSize(). 2019-05-08 02:11:07 +00:00
Program.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RWMutex.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Signals.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadLocal.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Threading.inc [llvm][Support] Provide interface to set thread priorities 2019-04-16 14:32:43 +00:00
Watchdog.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WindowsSupport.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
explicit_symbols.inc