diff options
author | Michael Biebl <biebl@debian.org> | 2018-01-28 22:49:17 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2018-01-28 22:49:17 +0100 |
commit | 1d42b86df9052528a8f56b2f52d8bc2faf87b2da (patch) | |
tree | 0d80f37a1ad6f02067261ee3e7ee62e1869fcd56 /src/basic/securebits-util.h | |
parent | 52ad194e0b816b8273dd8d0fea3e6d467f6ca34e (diff) | |
download | systemd-1d42b86df9052528a8f56b2f52d8bc2faf87b2da.tar.gz |
New upstream version 237
Diffstat (limited to 'src/basic/securebits-util.h')
-rw-r--r-- | src/basic/securebits-util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/securebits-util.h b/src/basic/securebits-util.h index aaa192f0a5..069d215488 100644 --- a/src/basic/securebits-util.h +++ b/src/basic/securebits-util.h @@ -24,6 +24,14 @@ int secure_bits_to_string_alloc(int i, char **s); int secure_bits_from_string(const char *s); + static inline bool secure_bits_is_valid(int i) { return ((SECURE_ALL_BITS | SECURE_ALL_LOCKS) & i) == i; } + +static inline int secure_bits_to_string_alloc_with_check(int n, char **s) { + if (!secure_bits_is_valid(n)) + return -EINVAL; + + return secure_bits_to_string_alloc(n, s); +} |