mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
devnode-acl: use set_put_strdup_full() and set_ensure_consume()
This commit is contained in:
parent
8bf796eeac
commit
c07eb49aff
|
@ -141,16 +141,12 @@ int devnode_acl_all(const char *seat,
|
|||
bool add, uid_t new_uid) {
|
||||
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
_cleanup_set_free_free_ Set *nodes = NULL;
|
||||
_cleanup_set_free_ Set *nodes = NULL;
|
||||
_cleanup_closedir_ DIR *dir = NULL;
|
||||
sd_device *d;
|
||||
char *n;
|
||||
int r;
|
||||
|
||||
nodes = set_new(&path_hash_ops);
|
||||
if (!nodes)
|
||||
return -ENOMEM;
|
||||
|
||||
r = sd_device_enumerator_new(&e);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -185,7 +181,7 @@ int devnode_acl_all(const char *seat,
|
|||
continue;
|
||||
|
||||
log_device_debug(d, "Found udev node %s for seat %s", node, seat);
|
||||
r = set_put_strdup(&nodes, node);
|
||||
r = set_put_strdup_full(&nodes, &path_hash_ops_free, node);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
@ -206,7 +202,7 @@ int devnode_acl_all(const char *seat,
|
|||
}
|
||||
|
||||
log_debug("Found static node %s for seat %s", n, seat);
|
||||
r = set_consume(nodes, n);
|
||||
r = set_ensure_consume(&nodes, &path_hash_ops_free, n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue