44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
From 19a8582024046a483f1631fd6be43126ea30b67c Mon Sep 17 00:00:00 2001
|
|
From: David Tardon <dtardon@redhat.com>
|
|
Date: Thu, 30 May 2024 10:46:13 +0200
|
|
Subject: [PATCH] cryptsetup-generator: continue parsing after error
|
|
|
|
Let's make the crypttab parser more robust and continue even if parsing
|
|
of a line failed.
|
|
|
|
(cherry picked from commit 83813bae7ae471862ff84b038b5e4eaefae41c98)
|
|
|
|
Resolves: RHEL-38859
|
|
---
|
|
src/cryptsetup/cryptsetup-generator.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
|
|
index 50c2a5093a..ae3e2282fd 100644
|
|
--- a/src/cryptsetup/cryptsetup-generator.c
|
|
+++ b/src/cryptsetup/cryptsetup-generator.c
|
|
@@ -562,7 +562,7 @@ static int add_crypttab_devices(void) {
|
|
struct stat st;
|
|
unsigned crypttab_line = 0;
|
|
_cleanup_fclose_ FILE *f = NULL;
|
|
- int r;
|
|
+ int r, ret = 0;
|
|
|
|
if (!arg_read_crypttab)
|
|
return 0;
|
|
@@ -602,11 +602,11 @@ static int add_crypttab_devices(void) {
|
|
}
|
|
|
|
r = add_crypttab_device(name, device, keyspec, options);
|
|
- if (r < 0)
|
|
- return r;
|
|
+ if (r < 0 && ret >= 0)
|
|
+ ret = r;
|
|
}
|
|
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
|
|
static int add_proc_cmdline_devices(void) {
|