naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From b419d118455739757b1b426989964123d2e94869 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 12 Apr 2022 20:42:32 +0200
Subject: [PATCH] shared/install: fix crash when reenable is called without
 --root

(cherry picked from commit 6e961aeb262521742a4cd92e4620de193f159f7c)

Resolves: #2120222
---
 src/shared/install.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/install.c b/src/shared/install.c
index d3661521a9..b8d18d1484 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2827,7 +2827,7 @@ static int normalize_linked_files(
                         return r;
 
                 const char *p = NULL;
-                if (i && i->path)
+                if (i && i->path && i->root)
                         /* Use startswith here, because we know that paths are normalized, and
                          * path_startswith() would give us a relative path, but we need an absolute path
                          * relative to i->root.