Przeglądaj źródła

udevmonitor: NCDUdevMonitorParser: handle "W:" entries, which aren't followed by a space. May happen
when not using udevd.

ambrop7 14 lat temu
rodzic
commit
fefaa8d171
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      udevmonitor/NCDUdevMonitorParser.c

+ 6 - 0
udevmonitor/NCDUdevMonitorParser.c

@@ -112,6 +112,11 @@ static int parse_message (NCDUdevMonitorParser *o)
         *line_end = '\0';
         *line_end = '\0';
         
         
         if (o->is_info_mode) {
         if (o->is_info_mode) {
+            // ignore W: entries with missing space
+            if (string_begins_with(line, "W:")) {
+                goto nextline;
+            }
+            
             // parse prefix
             // parse prefix
             if (strlen(line) < 3 || line[1] != ':' || line[2] != ' ') {
             if (strlen(line) < 3 || line[1] != ':' || line[2] != ' ') {
                 BLog(BLOG_ERROR, "failed to parse head");
                 BLog(BLOG_ERROR, "failed to parse head");
@@ -151,6 +156,7 @@ static int parse_message (NCDUdevMonitorParser *o)
                 }
                 }
             }
             }
         }
         }
+    nextline:
         
         
         first_line = 0;
         first_line = 0;
         line = line_end + 1;
         line = line_end + 1;