summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-14 18:02:30 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-14 18:02:30 +0100
commit5f68e74b6a795c5e3e1a6b3be3db85dfcd6b68c2 (patch)
treeeab3d7512c8ff7a711543e2d1fd6aad80c477c67 /src/core
parentf84f9974d827314c8ee86f65a5007ccee210422b (diff)
kmod-setup: improve for "kdbus" word on the kernel cmdline
We really shouldn't check for words with "strstr()"...
Diffstat (limited to 'src/core')
-rw-r--r--src/core/kmod-setup.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index 23df1fdf36..fd0a0e06ad 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -50,11 +50,24 @@ static void systemd_kmod_log(
static bool cmdline_check_kdbus(void) {
_cleanup_free_ char *line = NULL;
+ const char *p;
+ int r;
- if (proc_cmdline(&line) < 0)
+ r = proc_cmdline(&line);
+ if (r < 0)
return false;
- return strstr(line, "kdbus") != NULL;
+ p = line;
+ for (;;) {
+ _cleanup_free_ char *word = NULL;
+
+ r = unquote_first_word(&p, &word, true);
+ if (r <= 0)
+ return false;
+
+ if (streq(word, "kdbus"))
+ return true;
+ }
}
#endif