[PATCH] binutils: Attempt to retain permissions on copying file

Marco Atzeri marco.atzeri@gmail.com
Tue Feb 23 18:49:25 GMT 2021



On 23.02.2021 07:52, Siddhesh Poyarekar wrote:
> Writing into an existing file clears its S_ISUID and S_ISGID bits.
> Attempt to restore those permission bits but don't fail if it doesn't
> work.
> 
> Also, since the output file always exists (all callers create an empty
> file before calling smart_rename), open the file without any
> permission hints or O_CREAT.
> 
> binutils/
> 
> 	* rename.c (simple_copy): Don't use O_CREAT.
> 	(simple_copy)[!defined (_WIN32) || defined (__CYGWIN32__)]:
> 	Attempt to retain permission bits.


pay attention that __CYGWIN32__ is deprecated and
instead should be used __CYGWIN__

it exists only for obsolete compatibility

on 32bit platform

$ gcc -E -dM - </dev/null | grep CYGWIN
#define __CYGWIN__ 1
#define __CYGWIN32__ 1

on 64 bit

$ gcc -E -dM - </dev/null | grep CYGWIN
#define __CYGWIN__ 1



More information about the Binutils mailing list