summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/mount-util.c4
-rw-r--r--src/cgtop/cgtop.c4
-rw-r--r--src/core/device.c2
-rw-r--r--src/core/manager.c4
-rw-r--r--src/core/mount.c4
-rw-r--r--src/core/swap.c2
-rw-r--r--src/core/unit.c4
-rw-r--r--src/journal/sd-journal.c4
-rw-r--r--src/login/logind-acl.c2
-rw-r--r--src/shared/bus-unit-util.c2
-rw-r--r--src/shared/install.c2
-rw-r--r--src/sysctl/sysctl.c8
-rw-r--r--src/tmpfiles/tmpfiles.c6
13 files changed, 25 insertions, 23 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index a8947cefc2..b124345659 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -426,7 +426,7 @@ int bind_remount_recursive_with_mountinfo(const char *prefix, bool ro, char **bl
path_kill_slashes(cleaned);
- done = set_new(&string_hash_ops);
+ done = set_new(&path_hash_ops);
if (!done)
return -ENOMEM;
@@ -436,7 +436,7 @@ int bind_remount_recursive_with_mountinfo(const char *prefix, bool ro, char **bl
char *x;
unsigned long orig_flags;
- todo = set_new(&string_hash_ops);
+ todo = set_new(&path_hash_ops);
if (!todo)
return -ENOMEM;
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 1a73fb099d..413946182c 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -928,8 +928,8 @@ int main(int argc, char *argv[]) {
} else
log_debug("Cgroup path: %s", root);
- a = hashmap_new(&string_hash_ops);
- b = hashmap_new(&string_hash_ops);
+ a = hashmap_new(&path_hash_ops);
+ b = hashmap_new(&path_hash_ops);
if (!a || !b) {
r = log_oom();
goto finish;
diff --git a/src/core/device.c b/src/core/device.c
index a43664d3bd..b0dd469fd1 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -77,7 +77,7 @@ static int device_set_sysfs(Device *d, const char *sysfs) {
if (streq_ptr(d->sysfs, sysfs))
return 0;
- r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &string_hash_ops);
+ r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &path_hash_ops);
if (r < 0)
return r;
diff --git a/src/core/manager.c b/src/core/manager.c
index 5021e00b87..f57a08cd06 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -731,7 +731,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
if (r < 0)
goto fail;
- r = hashmap_ensure_allocated(&m->cgroup_unit, &string_hash_ops);
+ r = hashmap_ensure_allocated(&m->cgroup_unit, &path_hash_ops);
if (r < 0)
goto fail;
@@ -1314,7 +1314,7 @@ static void manager_build_unit_path_cache(Manager *m) {
set_free_free(m->unit_path_cache);
- m->unit_path_cache = set_new(&string_hash_ops);
+ m->unit_path_cache = set_new(&path_hash_ops);
if (!m->unit_path_cache) {
r = -ENOMEM;
goto fail;
diff --git a/src/core/mount.c b/src/core/mount.c
index 914458f8e6..7be4e89a61 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1837,7 +1837,7 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
mount->parameters_proc_self_mountinfo.what) {
/* Remember that this device might just have disappeared */
- if (set_ensure_allocated(&gone, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&gone, &path_hash_ops) < 0 ||
set_put(gone, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom(); /* we don't care too much about OOM here... */
}
@@ -1892,7 +1892,7 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
mount->from_proc_self_mountinfo &&
mount->parameters_proc_self_mountinfo.what) {
- if (set_ensure_allocated(&around, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&around, &path_hash_ops) < 0 ||
set_put(around, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom();
}
diff --git a/src/core/swap.c b/src/core/swap.c
index fffd8d4627..37c97bc14e 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -85,7 +85,7 @@ static int swap_set_devnode(Swap *s, const char *devnode) {
assert(s);
- r = hashmap_ensure_allocated(&UNIT(s)->manager->swaps_by_devnode, &string_hash_ops);
+ r = hashmap_ensure_allocated(&UNIT(s)->manager->swaps_by_devnode, &path_hash_ops);
if (r < 0)
return r;
diff --git a/src/core/unit.c b/src/core/unit.c
index 9a57bcfb4b..32119171fe 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -4594,7 +4594,7 @@ int unit_require_mounts_for(Unit *u, const char *path, UnitDependencyMask mask)
if (!path_is_absolute(path))
return -EINVAL;
- r = hashmap_ensure_allocated(&u->requires_mounts_for, &string_hash_ops);
+ r = hashmap_ensure_allocated(&u->requires_mounts_for, &path_hash_ops);
if (r < 0)
return r;
@@ -4631,7 +4631,7 @@ int unit_require_mounts_for(Unit *u, const char *path, UnitDependencyMask mask)
if (!x) {
char *q;
- r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &string_hash_ops);
+ r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &path_hash_ops);
if (r < 0)
return r;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 46e2b47344..4df0abe329 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1733,12 +1733,12 @@ static sd_journal *journal_new(int flags, const char *path) {
j->path = t;
}
- j->files = ordered_hashmap_new(&string_hash_ops);
+ j->files = ordered_hashmap_new(&path_hash_ops);
if (!j->files)
goto fail;
j->files_cache = ordered_hashmap_iterated_cache_new(j->files);
- j->directories_by_path = hashmap_new(&string_hash_ops);
+ j->directories_by_path = hashmap_new(&path_hash_ops);
j->mmap = mmap_cache_new();
if (!j->files_cache || !j->directories_by_path || !j->mmap)
goto fail;
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index d785f67ca3..3f355e7ea8 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -192,7 +192,7 @@ int devnode_acl_all(struct udev *udev,
assert(udev);
- nodes = set_new(&string_hash_ops);
+ nodes = set_new(&path_hash_ops);
if (!nodes)
return -ENOMEM;
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index bc77c3abdb..78b9b69557 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -2369,7 +2369,7 @@ int unit_show_processes(
if (r < 0)
return r;
- cgroups = hashmap_new(&string_hash_ops);
+ cgroups = hashmap_new(&path_hash_ops);
if (!cgroups)
return -ENOMEM;
diff --git a/src/shared/install.c b/src/shared/install.c
index 026aa32302..fdce447c89 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -522,7 +522,7 @@ static int mark_symlink_for_removal(
assert(p);
- r = set_ensure_allocated(remove_symlinks_to, &string_hash_ops);
+ r = set_ensure_allocated(remove_symlinks_to, &path_hash_ops);
if (r < 0)
return r;
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index a1dc95b2bb..d97656d6fe 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -110,19 +110,19 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
_cleanup_free_ char *l = NULL;
void *v;
int k;
+
k = read_line(f, LONG_LINE_MAX, &l);
if (k == 0)
break;
-
if (k < 0)
return log_error_errno(k, "Failed to read file '%s', ignoring: %m", path);
c++;
p = strstrip(l);
- if (!*p)
- continue;
+ if (isempty(p))
+ continue;
if (strchr(COMMENTS "\n", *p))
continue;
@@ -261,7 +261,7 @@ int main(int argc, char *argv[]) {
umask(0022);
- sysctl_options = ordered_hashmap_new(&string_hash_ops);
+ sysctl_options = ordered_hashmap_new(&path_hash_ops);
if (!sysctl_options) {
r = log_oom();
goto finish;
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 29e66b0a87..d887e9d148 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -383,9 +383,11 @@ static void load_unix_sockets(void) {
/* We maintain a cache of the sockets we found in /proc/net/unix to speed things up a little. */
- unix_sockets = set_new(&string_hash_ops);
- if (!unix_sockets)
+ unix_sockets = set_new(&path_hash_ops);
+ if (!unix_sockets) {
+ log_oom();
return;
+ }
f = fopen("/proc/net/unix", "re");
if (!f) {