summaryrefslogtreecommitdiffstats
path: root/src/shared/acl-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-07-21 22:13:12 +0200
committerLennart Poettering <lennart@poettering.net>2020-08-25 18:39:45 +0200
commit71281a7655d637bed06071e61c28a96fbf7370bb (patch)
treebaee77f2db054655e51341183b4fa129157ca384 /src/shared/acl-util.c
parentrm-rf: add new flag REMOVE_CHMOD (diff)
downloadsystemd-71281a7655d637bed06071e61c28a96fbf7370bb.tar.xz
systemd-71281a7655d637bed06071e61c28a96fbf7370bb.zip
acl-util: make sure acl_find_uid() initializes return parameters on success
Let's follow our usual coding style and initialize return parameters on success in all cases.
Diffstat (limited to 'src/shared/acl-util.c')
-rw-r--r--src/shared/acl-util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index dd2b1efb11..641e5bda7a 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -12,12 +12,13 @@
#include "user-util.h"
#include "util.h"
-int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) {
+int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *ret_entry) {
acl_entry_t i;
int r;
assert(acl);
- assert(entry);
+ assert(uid_is_valid(uid));
+ assert(ret_entry);
for (r = acl_get_entry(acl, ACL_FIRST_ENTRY, &i);
r > 0;
@@ -41,13 +42,14 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) {
acl_free(u);
if (b) {
- *entry = i;
+ *ret_entry = i;
return 1;
}
}
if (r < 0)
return -errno;
+ *ret_entry = NULL;
return 0;
}