summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/strv.c2
-rw-r--r--src/basic/util.c8
-rw-r--r--src/basic/util.h1
3 files changed, 6 insertions, 5 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 69eb8c7fdb..72964a166a 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -289,7 +289,7 @@ int strv_split_quoted(char ***t, const char *s, ExtractFlags flags) {
for (;;) {
_cleanup_free_ char *word = NULL;
- r = extract_first_word(&s, &word, NULL, flags);
+ r = extract_first_word(&s, &word, NULL, flags|EXTRACT_QUOTES);
if (r < 0)
return r;
if (r == 0)
diff --git a/src/basic/util.c b/src/basic/util.c
index 8ddd627ac0..d4c385fcef 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -4843,7 +4843,7 @@ int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value)) {
_cleanup_free_ char *word = NULL;
char *value = NULL;
- r = extract_first_word(&p, &word, NULL, EXTRACT_RELAX);
+ r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX);
if (r < 0)
return r;
if (r == 0)
@@ -4883,7 +4883,7 @@ int get_proc_cmdline_key(const char *key, char **value) {
_cleanup_free_ char *word = NULL;
const char *e;
- r = extract_first_word(&p, &word, NULL, EXTRACT_RELAX);
+ r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX);
if (r < 0)
return r;
if (r == 0)
@@ -5746,14 +5746,14 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
case VALUE:
if (c == 0)
goto finish_force_terminate;
- else if (c == '\'') {
+ else if (c == '\'' && (flags & EXTRACT_QUOTES)) {
if (!GREEDY_REALLOC(s, allocated, sz+1))
return -ENOMEM;
state = SINGLE_QUOTE;
} else if (c == '\\')
state = VALUE_ESCAPE;
- else if (c == '\"') {
+ else if (c == '\"' && (flags & EXTRACT_QUOTES)) {
if (!GREEDY_REALLOC(s, allocated, sz+1))
return -ENOMEM;
diff --git a/src/basic/util.h b/src/basic/util.h
index a5d035b8bd..82fb771e20 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -858,6 +858,7 @@ typedef enum ExtractFlags {
EXTRACT_RELAX = 1,
EXTRACT_CUNESCAPE = 2,
EXTRACT_CUNESCAPE_RELAX = 4,
+ EXTRACT_QUOTES = 8,
} ExtractFlags;
int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags);