*ambient = cap_get_ambient(value);
- if (*ambient == -1) {
- return F_status_set_error(F_support_not);
- }
-
- return F_okay;
+ return (*ambient == -1) ? F_status_set_error(F_support_not) : F_okay;
}
#endif // _di_f_capability_ambient_get_
#endif // _di_level_0_parameter_checking_
*destination = cap_dup(source);
-
- if (*destination) {
- return F_okay;
- }
+ if (*destination) return F_okay;
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_copy_int(external);
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_get_fd(descriptor);
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (errno == EBADFD) return F_status_set_error(F_descriptor_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_get_file(path.string);
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (errno == EBADFD) return F_status_set_error(F_descriptor_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_from_text(text.string);
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_init();
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
*bound = cap_get_bound(value);
- if (*bound == -1) {
- return F_status_set_error(F_known_not);
- }
-
- return F_okay;
+ return (*bound == -1) ? F_status_set_error(F_known_not) : F_okay;
}
#endif // _di_f_capability_process_bound_get_
#endif // _di_level_0_parameter_checking_
*capability = cap_get_proc();
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
#endif // _di_level_0_parameter_checking_
*capability = cap_get_pid(id);
-
- if (*capability) {
- return F_okay;
- }
+ if (*capability) return F_okay;
return F_status_set_error(F_failure);
}
#ifndef _di_f_capability_supported_ambient_
bool f_capability_supported_ambient(void) {
- if (CAP_AMBIENT_SUPPORTED()) {
- return F_true;
- }
-
- return F_false;
+ return CAP_AMBIENT_SUPPORTED() ? F_true : F_false;
}
#endif // _di_f_capability_supported_ambient_
#ifndef _di_f_capability_supported_code_
bool f_capability_supported_code(const f_capability_value_t code) {
- if (CAP_IS_SUPPORTED(code)) {
- return F_true;
- }
-
- return F_false;
+ return CAP_IS_SUPPORTED(code) ? F_true : F_false;
}
#endif // _di_f_capability_supported_code_
if (!name) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- char *result = cap_to_name(code);
+ char * const result = cap_to_name(code);
if (result) {
const f_number_unsigned_t length = strlen(result);
ssize_t length = 0;
- char *result = cap_to_text(capability, &length);
+ char * const result = cap_to_text(capability, &length);
if (result) {
if (text->used + length + 1 > text->size) {
- if (text->used + length + 1 > F_string_t_size_d) {
- return F_status_set_error(F_string_too_large);
- }
+ if (text->used + length + 1 > F_string_t_size_d) return F_status_set_error(F_string_too_large);
{
const f_status_t status = f_memory_array_resize(text->used + length + 1, sizeof(f_char_t), (void **) &text->string, &text->used, &text->size);