diff options
author | Érico Rolim <[email protected]> | 2020-11-01 22:49:46 -0300 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2020-11-03 15:54:14 +0100 |
commit | ced66615bd8c3671c50252cba254fb939b04e362 (patch) | |
tree | b26cee9fe348001db1660cfd464107fcc37765b3 /lib | |
parent | 95ec1659cdd134a5fd260fffd9e3220909851903 (diff) |
Switch from numerical to defined constants for permissions.
Use defined constants for permission values. Also add fallback
definitions for them in system.h, to allow for compatibility with
systems that don't provide these macros.
Include system.h in all tests/ files that required it.
Signed-off-by: Érico Rolim <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 6 | ||||
-rw-r--r-- | lib/system.h | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index f4ab6d48..663a7aa5 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2020-11-01 Érico N. Rolim <[email protected]> + + * system.h (ACCESSPERMS): Define macro if it doesn't exist. + (ALLPERMS): Likewise. + (DEFFILEMODE): Likewise. + 2020-06-11 Mark Wielaaard <[email protected]> * printversion.c (print_version): Update copyright year. diff --git a/lib/system.h b/lib/system.h index 292082bd..7b650f11 100644 --- a/lib/system.h +++ b/lib/system.h @@ -85,6 +85,18 @@ __res; }) #endif +#ifndef ACCESSPERMS +#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ +#endif + +#ifndef ALLPERMS +#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ +#endif + +#ifndef DEFFILEMODE +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666 */ +#endif + static inline ssize_t __attribute__ ((unused)) pwrite_retry (int fd, const void *buf, size_t len, off_t off) { |