1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00

core/mount: use set_put_strdup_full()

This commit is contained in:
Yu Watanabe 2022-05-15 05:40:34 +09:00
parent f17061ef95
commit 6688b72d32

View File

@ -1984,7 +1984,7 @@ static int drain_libmount(Manager *m) {
}
static int mount_process_proc_self_mountinfo(Manager *m) {
_cleanup_set_free_free_ Set *around = NULL, *gone = NULL;
_cleanup_set_free_ Set *around = NULL, *gone = NULL;
const char *what;
int r;
@ -2015,13 +2015,10 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
* existed. */
if (mount->from_proc_self_mountinfo &&
mount->parameters_proc_self_mountinfo.what) {
mount->parameters_proc_self_mountinfo.what)
/* Remember that this device might just have disappeared */
if (set_ensure_allocated(&gone, &path_hash_ops) < 0 ||
set_put_strdup(&gone, mount->parameters_proc_self_mountinfo.what) < 0)
if (set_put_strdup_full(&gone, &path_hash_ops_free, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom(); /* we don't care too much about OOM here... */
}
mount->from_proc_self_mountinfo = false;
assert_se(update_parameters_proc_self_mountinfo(mount, NULL, NULL, NULL) >= 0);
@ -2079,13 +2076,10 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
if (mount_is_mounted(mount) &&
mount->from_proc_self_mountinfo &&
mount->parameters_proc_self_mountinfo.what) {
mount->parameters_proc_self_mountinfo.what)
/* Track devices currently used */
if (set_ensure_allocated(&around, &path_hash_ops) < 0 ||
set_put_strdup(&around, mount->parameters_proc_self_mountinfo.what) < 0)
if (set_put_strdup_full(&around, &path_hash_ops_free, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom();
}
/* Reset the flags for later calls */
mount->proc_flags = 0;