zkey: Allow comments and empty lines in properties files

Lines with '#' as first character are treated as comments, and are
skipped. Empty lines are also skipped.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2021-05-26 13:28:39 +02:00
committed by Jan Höppner
parent b1997c7aac
commit 52b6e57743

View File

@@ -386,8 +386,12 @@ int properties_load(struct properties *properties, const char *filename,
while (fgets(line, sizeof(line), fp) != NULL) {
len = strlen(line);
if (line[len-1] == '\n')
line[len-1] = '\0';
if (line[len - 1] == '\n')
line[len - 1] = '\0';
if (line[0] == '#')
continue;
if (strlen(line) == 0)
continue;
ch = strchr(line, '=');
if (ch == NULL) {
rc = -EPERM;