Blob Blame History Raw
From a13e97e5110121e38f9a6d9550b5ac07250a37af Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 30 Nov 2017 15:07:48 +0100
Subject: [PATCH] dracut-install: remove double "//" in path names

makes relative symlinks shorter
---
 install/dracut-install.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/install/dracut-install.c b/install/dracut-install.c
index 82e882cc..90077226 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -633,7 +633,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
 
         hashmap_put(items, i, i);
 
-        ret = asprintf(&fulldstpath, "%s/%s", destrootdir, dst);
+        ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
         if (ret < 0) {
                 log_error("Out of memory!");
                 exit(EXIT_FAILURE);
@@ -720,7 +720,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
                 if (lstat(fulldstpath, &sb) != 0) {
                         _cleanup_free_ char *absdestpath = NULL;
 
-                        ret = asprintf(&absdestpath, "%s/%s", destrootdir, abspath);
+                        ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
                         if (ret < 0) {
                                 log_error("Out of memory!");
                                 exit(EXIT_FAILURE);