]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootspec: let's actually use the result of strstrip() for further parsing
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Sep 2022 09:07:22 +0000 (11:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Sep 2022 12:25:48 +0000 (14:25 +0200)
Also, given we are looking for whitespace as separators, just pass NULL
as separators, extract_first_word() defaults to whitespace after all.

src/shared/bootspec.c

index 90ae7887bf14d5ca4422750674f0085bfebe47d7..c8ebbfbf1901e9914557d12f424ba537cbb3c6de 100644 (file)
@@ -205,11 +205,11 @@ static int boot_entry_load_type1(
 
                 line++;
 
-                if (IN_SET(*strstrip(buf), '#', '\0'))
+                p = strstrip(buf);
+                if (IN_SET(p[0], '#', '\0'))
                         continue;
 
-                p = buf;
-                r = extract_first_word(&p, &field, " \t", 0);
+                r = extract_first_word(&p, &field, NULL, 0);
                 if (r < 0) {
                         log_error_errno(r, "Failed to parse config file %s line %u: %m", tmp.path, line);
                         continue;
@@ -331,11 +331,11 @@ int boot_loader_read_conf(BootConfig *config, FILE *file, const char *path) {
 
                 line++;
 
-                if (IN_SET(*strstrip(buf), '#', '\0'))
+                p = strstrip(buf);
+                if (IN_SET(p[0], '#', '\0'))
                         continue;
 
-                p = buf;
-                r = extract_first_word(&p, &field, " \t", 0);
+                r = extract_first_word(&p, &field, NULL, 0);
                 if (r < 0) {
                         log_error_errno(r, "Failed to parse config file %s line %u: %m", path, line);
                         continue;