ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
594167
From b419d118455739757b1b426989964123d2e94869 Mon Sep 17 00:00:00 2001
594167
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
594167
Date: Tue, 12 Apr 2022 20:42:32 +0200
594167
Subject: [PATCH] shared/install: fix crash when reenable is called without
594167
 --root
594167
594167
(cherry picked from commit 6e961aeb262521742a4cd92e4620de193f159f7c)
594167
594167
Resolves: #2120222
594167
---
594167
 src/shared/install.c | 2 +-
594167
 1 file changed, 1 insertion(+), 1 deletion(-)
594167
594167
diff --git a/src/shared/install.c b/src/shared/install.c
594167
index d3661521a9..b8d18d1484 100644
594167
--- a/src/shared/install.c
594167
+++ b/src/shared/install.c
594167
@@ -2827,7 +2827,7 @@ static int normalize_linked_files(
594167
                         return r;
594167
 
594167
                 const char *p = NULL;
594167
-                if (i && i->path)
594167
+                if (i && i->path && i->root)
594167
                         /* Use startswith here, because we know that paths are normalized, and
594167
                          * path_startswith() would give us a relative path, but we need an absolute path
594167
                          * relative to i->root.