summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/automount.c7
-rw-r--r--src/core/mount.c7
-rw-r--r--src/core/socket.c6
-rw-r--r--src/core/unit.c5
4 files changed, 12 insertions, 13 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 2ee32312fb..df98711d96 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -141,13 +141,12 @@ static void automount_done(Unit *u) {
static int automount_add_mount_links(Automount *a) {
_cleanup_free_ char *parent = NULL;
- int r;
assert(a);
- r = path_get_parent(a->where, &parent);
- if (r < 0)
- return r;
+ parent = dirname_malloc(a->where);
+ if (!parent)
+ return -ENOMEM;
return unit_require_mounts_for(UNIT(a), parent);
}
diff --git a/src/core/mount.c b/src/core/mount.c
index 59f56bdefa..9d8b55da58 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -252,9 +252,10 @@ static int mount_add_mount_links(Mount *m) {
if (!path_equal(m->where, "/")) {
/* Adds in links to other mount points that might lie further
* up in the hierarchy */
- r = path_get_parent(m->where, &parent);
- if (r < 0)
- return r;
+
+ parent = dirname_malloc(m->where);
+ if (!parent)
+ return -ENOMEM;
r = unit_require_mounts_for(UNIT(m), parent);
if (r < 0)
diff --git a/src/core/socket.c b/src/core/socket.c
index 49cef210dc..8ea7bd9af4 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1169,9 +1169,9 @@ static int usbffs_dispatch_eps(SocketPort *p) {
_cleanup_free_ char *path = NULL;
int r, i, n, k;
- r = path_get_parent(p->path, &path);
- if (r < 0)
- return r;
+ path = dirname_malloc(p->path);
+ if (!path)
+ return -ENOMEM;
r = scandir(path, &ent, usbffs_select_ep, alphasort);
if (r < 0)
diff --git a/src/core/unit.c b/src/core/unit.c
index 17c135cf3f..b44a2a5e2d 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -417,12 +417,11 @@ static void unit_remove_transient(Unit *u) {
STRV_FOREACH(i, u->dropin_paths) {
_cleanup_free_ char *p = NULL;
- int r;
(void) unlink(*i);
- r = path_get_parent(*i, &p);
- if (r >= 0)
+ p = dirname_malloc(*i);
+ if (p)
(void) rmdir(p);
}
}