diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-12-17 22:05:49 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-12-17 22:05:49 -0500 |
commit | 18fc03882d49ff46b41a53afc0d6232e1dfbbb35 (patch) | |
tree | dec8b26d1801c4d170cfb148c3758e95dfd4e1c9 /util.h | |
parent | 50b3caa2625b4377b03fe8ca6967f769cdd6ee95 (diff) | |
download | bfs-18fc03882d49ff46b41a53afc0d6232e1dfbbb35.tar.xz |
color: Support coloring files with capabilities
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -33,10 +33,18 @@ # define BFS_HAS_INCLUDE(header, fallback) fallback #endif -#define BFS_HAS_MNTENT BFS_HAS_INCLUDE(<mntent.h>, __GLIBC__) -#define BFS_HAS_SYS_MKDEV BFS_HAS_INCLUDE(<sys/mkdev.h>, false) -#define BFS_HAS_SYS_PARAM BFS_HAS_INCLUDE(<sys/param.h>, true) -#define BFS_HAS_SYS_SYSMACROS BFS_HAS_INCLUDE(<sys/sysmacros.h>, __GLIBC__) +#define BFS_HAS_MNTENT BFS_HAS_INCLUDE(<mntent.h>, __GLIBC__) +#define BFS_HAS_SYS_CAPABILITY BFS_HAS_INCLUDE(<sys/capability.h>, __linux__) +#define BFS_HAS_SYS_MKDEV BFS_HAS_INCLUDE(<sys/mkdev.h>, false) +#define BFS_HAS_SYS_PARAM BFS_HAS_INCLUDE(<sys/param.h>, true) +#define BFS_HAS_SYS_SYSMACROS BFS_HAS_INCLUDE(<sys/sysmacros.h>, __GLIBC__) + +#if BFS_HAS_SYS_CAPABILITY +# include <sys/capability.h> +# ifdef CAP_CHOWN +# define BFS_HAS_POSIX1E_CAPABILITIES true +# endif +#endif #if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) # define FNM_CASEFOLD FNM_IGNORECASE @@ -187,4 +195,11 @@ int bfs_major(dev_t dev); */ int bfs_minor(dev_t dev); +struct BFTW; + +/** + * Check if a file has a non-trvial capability set. + */ +bool bfs_check_capabilities(const struct BFTW *ftwbuf); + #endif // BFS_UTIL_H |