From 9813d8354cc9af33b739e8d478368adfb548edc1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 8 Mar 2021 20:41:34 +0100 Subject: [PATCH] fs-util: port symlink_idempotent() to path_extract_directory() --- src/basic/fs-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index cc219d297b..b2a4e8036f 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -428,9 +428,9 @@ int symlink_idempotent(const char *from, const char *to, bool make_relative) { if (make_relative) { _cleanup_free_ char *parent = NULL; - parent = dirname_malloc(to); - if (!parent) - return -ENOMEM; + r = path_extract_directory(to, &parent); + if (r < 0) + return r; r = path_make_relative(parent, from, &relpath); if (r < 0)