Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > a2af656ce25b3c61f78ec27a806d81f0 > files > 116

systemd-241-8.2.mga7.src.rpm

From 04cccb11eb8b848d7f14654fb04c7fc3c674e2b7 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 27 Jun 2019 13:02:28 +0200
Subject: [PATCH 215/264] cryptsetup-generator: fix luks-* entry parsing from
 crypttab

This reverts a part of commit 49fe5c099639 ('tree-wide: port various places
over to STARTSWITH_SET()') that replaced a pair of startswith() calls
with STARTSWITH_SET().

They were in fact for a different strings (device vs. name), botching
the crypttap parsing.

(cherry picked from commit 844d5a87c9aec9e70546a4addc4e0da9422effe0)
(cherry picked from commit 15194f22ed10c722a4fc4f2bbe1526bc8d0f5409)
---
 src/cryptsetup/cryptsetup-generator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 8759a26148..ef93ffd645 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -517,9 +517,11 @@ static int add_crypttab_devices(void) {
                         continue;
                 }
 
-                uuid = STARTSWITH_SET(device, "UUID=", "luks-");
+                uuid = startswith(device, "UUID=");
                 if (!uuid)
                         uuid = path_startswith(device, "/dev/disk/by-uuid/");
+                if (!uuid)
+                        uuid = startswith(name, "luks-");
                 if (uuid)
                         d = hashmap_get(arg_disks, uuid);
 
-- 
2.22.1