[RFC] [PATCH] Use numeric permissions directly.

Mark Wielaard mark@klomp.org
Mon Oct 26 18:51:32 GMT 2020


Hi Érico,

On Mon, 2020-10-26 at 01:29 -0300, Érico Nogueira via Elfutils-devel wrote:
> musl doesn't define ALLPERMS and ACESSPERMS macros, and the code already
> uses literals for these same values in some place. This commit applies
> the same style to the whole project.
> 
> Signed-off-by: Érico Rolim <erico.erc@gmail.com>
> ---
> 
> This commit can go the other way as well, by adding blocks like
> 
>  /* musl libc doesn't define these constants */
>  #ifndef ALLPERMS
>  #define ALPPERMS 07777
>  #endif
>  [...]
> 
> and then replacing all ocurrences of literal 0777 or 07777 with the
> respective macros.

I prefer this alternative (although I admit we haven't be very
consistent with using the macro names). If you add the above
check/define for the constants to lib/system.h I think it will
automatically be picked up in all places that you had to change.

>  src/ar.c            | 8 ++++----
>  src/elfcompress.c   | 4 ++--
>  src/ranlib.c        | 2 +-
>  src/strip.c         | 2 +-
>  tests/elfstrmerge.c | 4 ++--

Otherwise it should be a simple addition of #include "system.h" at the
top of those files.

Cheers,

Mark


More information about the Elfutils-devel mailing list