Harald Hoyer d88ded
From a13e97e5110121e38f9a6d9550b5ac07250a37af Mon Sep 17 00:00:00 2001
Harald Hoyer d88ded
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer d88ded
Date: Thu, 30 Nov 2017 15:07:48 +0100
Harald Hoyer d88ded
Subject: [PATCH] dracut-install: remove double "//" in path names
Harald Hoyer d88ded
Harald Hoyer d88ded
makes relative symlinks shorter
Harald Hoyer d88ded
---
Harald Hoyer d88ded
 install/dracut-install.c | 4 ++--
Harald Hoyer d88ded
 1 file changed, 2 insertions(+), 2 deletions(-)
Harald Hoyer d88ded
Harald Hoyer d88ded
diff --git a/install/dracut-install.c b/install/dracut-install.c
Harald Hoyer d88ded
index 82e882cc..90077226 100644
Harald Hoyer d88ded
--- a/install/dracut-install.c
Harald Hoyer d88ded
+++ b/install/dracut-install.c
Harald Hoyer d88ded
@@ -633,7 +633,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
Harald Hoyer d88ded
 
Harald Hoyer d88ded
         hashmap_put(items, i, i);
Harald Hoyer d88ded
 
Harald Hoyer d88ded
-        ret = asprintf(&fulldstpath, "%s/%s", destrootdir, dst);
Harald Hoyer d88ded
+        ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
Harald Hoyer d88ded
         if (ret < 0) {
Harald Hoyer d88ded
                 log_error("Out of memory!");
Harald Hoyer d88ded
                 exit(EXIT_FAILURE);
Harald Hoyer d88ded
@@ -720,7 +720,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
Harald Hoyer d88ded
                 if (lstat(fulldstpath, &sb) != 0) {
Harald Hoyer d88ded
                         _cleanup_free_ char *absdestpath = NULL;
Harald Hoyer d88ded
 
Harald Hoyer d88ded
-                        ret = asprintf(&absdestpath, "%s/%s", destrootdir, abspath);
Harald Hoyer d88ded
+                        ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
Harald Hoyer d88ded
                         if (ret < 0) {
Harald Hoyer d88ded
                                 log_error("Out of memory!");
Harald Hoyer d88ded
                                 exit(EXIT_FAILURE);
Harald Hoyer d88ded