shutdown: fix /proc/cmdline reading of 'quiet'
authorKay Sievers <kay@vrfy.org>
Wed, 10 Jul 2013 22:13:46 +0000 (00:13 +0200)
committerKay Sievers <kay@vrfy.org>
Wed, 10 Jul 2013 22:13:46 +0000 (00:13 +0200)
src/core/shutdown.c

index c02a14d..fe7a073 100644 (file)
@@ -144,11 +144,18 @@ int main(int argc, char *argv[]) {
                 char *w, *state;
                 size_t l;
 
-                FOREACH_WORD_QUOTED(w, l, line, state)
-                        if (streq(w, "quiet")) {
+                FOREACH_WORD_QUOTED(w, l, line, state) {
+                        _cleanup_free_ char *word;
+
+                        word = strndup(w, l);
+                        if (!word)
+                                break;
+
+                        if (streq(word, "quiet")) {
                                 log_set_max_level(LOG_WARNING);
                                 break;
                         }
+                }
         }
 
         log_parse_environment();