diff options
-rw-r--r-- | src/basic/cap-list.c | 2 | ||||
-rw-r--r-- | src/basic/env-util.c | 2 | ||||
-rw-r--r-- | src/basic/extract-word.c | 2 | ||||
-rw-r--r-- | src/basic/extract-word.h | 2 | ||||
-rw-r--r-- | src/basic/proc-cmdline.c | 2 | ||||
-rw-r--r-- | src/core/device.c | 4 | ||||
-rw-r--r-- | src/core/load-fragment.c | 46 | ||||
-rw-r--r-- | src/journal-remote/journal-remote-main.c | 2 | ||||
-rw-r--r-- | src/locale/keymap-util.c | 6 | ||||
-rw-r--r-- | src/resolve/resolvconf-compat.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-conf.c | 4 | ||||
-rw-r--r-- | src/resolve/resolved-dns-trust-anchor.c | 4 | ||||
-rw-r--r-- | src/shared/bus-unit-util.c | 28 | ||||
-rw-r--r-- | src/shared/condition.c | 2 | ||||
-rw-r--r-- | src/shared/conf-parser.c | 2 | ||||
-rw-r--r-- | src/shared/cpu-set-util.c | 2 | ||||
-rw-r--r-- | src/shared/mount-util.c | 2 | ||||
-rw-r--r-- | src/shared/securebits-util.c | 2 | ||||
-rw-r--r-- | src/sysusers/sysusers.c | 2 | ||||
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 4 | ||||
-rw-r--r-- | src/test/test-extract-word.c | 54 | ||||
-rw-r--r-- | src/test/test-string-util.c | 2 | ||||
-rw-r--r-- | src/test/test-strv.c | 4 | ||||
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 4 |
24 files changed, 93 insertions, 93 deletions
diff --git a/src/basic/cap-list.c b/src/basic/cap-list.c index 2c0b7416a4..79d6a40aa9 100644 --- a/src/basic/cap-list.c +++ b/src/basic/cap-list.c @@ -100,7 +100,7 @@ int capability_set_from_string(const char *s, uint64_t *set) { _cleanup_free_ char *word = NULL; int r; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return r; if (r <= 0) diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 896eec5835..b39b1ed0f8 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -688,7 +688,7 @@ char **replace_env_argv(char **argv, char **env) { if (e) { int r; - r = strv_split_extract(&m, e, WHITESPACE, EXTRACT_RELAX|EXTRACT_QUOTES); + r = strv_split_extract(&m, e, WHITESPACE, EXTRACT_RELAX|EXTRACT_UNQUOTE); if (r < 0) { ret[k] = NULL; strv_free(ret); diff --git a/src/basic/extract-word.c b/src/basic/extract-word.c index a861b56653..34cfb36a4a 100644 --- a/src/basic/extract-word.c +++ b/src/basic/extract-word.c @@ -135,7 +135,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra for (;; (*p)++, c = **p) { if (c == 0) goto finish_force_terminate; - else if (IN_SET(c, '\'', '"') && (flags & EXTRACT_QUOTES)) { + else if (IN_SET(c, '\'', '"') && (flags & EXTRACT_UNQUOTE)) { quote = c; break; } else if (c == '\\' && !(flags & EXTRACT_RETAIN_ESCAPE)) { diff --git a/src/basic/extract-word.h b/src/basic/extract-word.h index 705ebbe95b..e2d433893a 100644 --- a/src/basic/extract-word.h +++ b/src/basic/extract-word.h @@ -7,7 +7,7 @@ typedef enum ExtractFlags { EXTRACT_RELAX = 1 << 0, EXTRACT_CUNESCAPE = 1 << 1, EXTRACT_CUNESCAPE_RELAX = 1 << 2, - EXTRACT_QUOTES = 1 << 3, + EXTRACT_UNQUOTE = 1 << 3, EXTRACT_DONT_COALESCE_SEPARATORS = 1 << 4, EXTRACT_RETAIN_ESCAPE = 1 << 5, } ExtractFlags; diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index b82ca4b21b..09169cf963 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -47,7 +47,7 @@ static int proc_cmdline_extract_first(const char **p, char **ret_word, ProcCmdli _cleanup_free_ char *word = NULL; const char *c; - r = extract_first_word(&q, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX); + r = extract_first_word(&q, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX); if (r < 0) return r; if (r == 0) diff --git a/src/core/device.c b/src/core/device.c index f478393f1a..e2abca469a 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -374,7 +374,7 @@ static int device_add_udev_wants(Unit *u, sd_device *dev) { for (;;) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&wants, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&wants, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -626,7 +626,7 @@ static int device_process_new(Manager *m, sd_device *dev) { for (;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&alias, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&alias, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 7aed83101b..3288b0b838 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -334,7 +334,7 @@ int config_parse_unit_path_strv_printf( for (p = rvalue;;) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -638,7 +638,7 @@ int config_parse_exec( semicolon = false; - r = extract_first_word_and_warn(&p, &firstword, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue); + r = extract_first_word_and_warn(&p, &firstword, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE, unit, filename, line, rvalue); if (r <= 0) return 0; @@ -784,7 +784,7 @@ int config_parse_exec( continue; } - r = extract_first_word_and_warn(&p, &word, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue); + r = extract_first_word_and_warn(&p, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE, unit, filename, line, rvalue); if (r == 0) break; if (r < 0) @@ -2244,7 +2244,7 @@ int config_parse_environ( for (p = rvalue;; ) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -2312,7 +2312,7 @@ int config_parse_pass_environ( for (;;) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -2388,7 +2388,7 @@ int config_parse_unset_environ( for (;;) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -2463,7 +2463,7 @@ int config_parse_log_extra_fields( struct iovec *t; const char *eq; - r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -2688,7 +2688,7 @@ int config_parse_unit_requires_mounts_for( for (;;) { _cleanup_free_ char *word = NULL, *resolved = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -2883,7 +2883,7 @@ int config_parse_syscall_archs( _cleanup_free_ char *word = NULL; uint32_t a; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -2987,7 +2987,7 @@ int config_parse_address_families( _cleanup_free_ char *word = NULL; int af; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -3306,7 +3306,7 @@ int config_parse_delegate( _cleanup_free_ char *word = NULL; CGroupController cc; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -3363,7 +3363,7 @@ int config_parse_device_allow( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3434,7 +3434,7 @@ int config_parse_io_device_weight( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3508,7 +3508,7 @@ int config_parse_io_device_latency( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3582,7 +3582,7 @@ int config_parse_io_limit( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3673,7 +3673,7 @@ int config_parse_blockio_device_weight( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3751,7 +3751,7 @@ int config_parse_blockio_bandwidth( return 0; } - r = extract_first_word(&p, &path, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -3871,7 +3871,7 @@ int config_parse_exec_directories( for (p = rvalue;;) { _cleanup_free_ char *word = NULL, *k = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -4007,7 +4007,7 @@ int config_parse_namespace_path_strv( const char *w; bool ignore_enoent = false, shall_prefix = false; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -4085,7 +4085,7 @@ int config_parse_temporary_filesystems( _cleanup_free_ char *word = NULL, *path = NULL, *resolved = NULL; const char *w; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) return 0; if (r == -ENOMEM) @@ -4161,7 +4161,7 @@ int config_parse_bind_paths( char *s = NULL, *d = NULL; bool rbind = true, ignore_enoent = false; - r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_QUOTES|EXTRACT_DONT_COALESCE_SEPARATORS); + r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS); if (r == 0) break; if (r == -ENOMEM) @@ -4190,7 +4190,7 @@ int config_parse_bind_paths( /* Optionally, the destination is specified. */ if (p && p[-1] == ':') { - r = extract_first_word(&p, &destination, ":" WHITESPACE, EXTRACT_QUOTES|EXTRACT_DONT_COALESCE_SEPARATORS); + r = extract_first_word(&p, &destination, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS); if (r == -ENOMEM) return log_oom(); if (r < 0) { @@ -4219,7 +4219,7 @@ int config_parse_bind_paths( if (p && p[-1] == ':') { _cleanup_free_ char *options = NULL; - r = extract_first_word(&p, &options, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &options, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index d32c51c3ce..329505cd2c 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -123,7 +123,7 @@ static int spawn_getter(const char *getter) { _cleanup_strv_free_ char **words = NULL; assert(getter); - r = strv_split_extract(&words, getter, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&words, getter, WHITESPACE, EXTRACT_UNQUOTE); if (r < 0) return log_error_errno(r, "Failed to split getter option: %m"); diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index c7dcd8ad38..1394514839 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -252,7 +252,7 @@ int x11_read_data(Context *c, sd_bus_message *m) { if (in_section && first_word(l, "Option")) { _cleanup_strv_free_ char **a = NULL; - r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_UNQUOTE); if (r < 0) return r; @@ -276,7 +276,7 @@ int x11_read_data(Context *c, sd_bus_message *m) { } else if (!in_section && first_word(l, "Section")) { _cleanup_strv_free_ char **a = NULL; - r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_UNQUOTE); if (r < 0) return -ENOMEM; @@ -491,7 +491,7 @@ static int read_next_mapping(const char* filename, if (IN_SET(l[0], 0, '#')) continue; - r = strv_split_extract(&b, l, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&b, l, WHITESPACE, EXTRACT_UNQUOTE); if (r < 0) return r; diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index d1f65056d0..8cd14711df 100644 --- a/src/resolve/resolvconf-compat.c +++ b/src/resolve/resolvconf-compat.c @@ -82,7 +82,7 @@ static int parse_search_domain(const char *string) { for (;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&string, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&string, &word, NULL, EXTRACT_UNQUOTE); if (r < 0) return r; if (r == 0) diff --git a/src/resolve/resolved-conf.c b/src/resolve/resolved-conf.c index 7b2938fea3..0c8d2a679c 100644 --- a/src/resolve/resolved-conf.c +++ b/src/resolve/resolved-conf.c @@ -119,7 +119,7 @@ int manager_parse_search_domains_and_warn(Manager *m, const char *string) { for (;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&string, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&string, &word, NULL, EXTRACT_UNQUOTE); if (r < 0) return r; if (r == 0) @@ -308,7 +308,7 @@ int config_parse_dnssd_txt(const char *unit, const char *filename, unsigned line int r; r = extract_first_word(&rvalue, &word, NULL, - EXTRACT_QUOTES|EXTRACT_CUNESCAPE|EXTRACT_CUNESCAPE_RELAX); + EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE|EXTRACT_CUNESCAPE_RELAX); if (r == 0) break; if (r == -ENOMEM) diff --git a/src/resolve/resolved-dns-trust-anchor.c b/src/resolve/resolved-dns-trust-anchor.c index 3e4cc331d9..89e48403f0 100644 --- a/src/resolve/resolved-dns-trust-anchor.c +++ b/src/resolve/resolved-dns-trust-anchor.c @@ -216,7 +216,7 @@ static int dns_trust_anchor_load_positive(DnsTrustAnchor *d, const char *path, u assert(d); assert(line); - r = extract_first_word(&p, &domain, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &domain, NULL, EXTRACT_UNQUOTE); if (r < 0) return log_warning_errno(r, "Unable to parse domain in line %s:%u: %m", path, line); @@ -386,7 +386,7 @@ static int dns_trust_anchor_load_negative(DnsTrustAnchor *d, const char *path, u assert(d); assert(line); - r = extract_first_word(&p, &domain, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &domain, NULL, EXTRACT_UNQUOTE); if (r < 0) return log_warning_errno(r, "Unable to parse line %s:%u: %m", path, line); diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 2ea25d830a..6a7358e301 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -325,12 +325,12 @@ static int bus_append_exec_command(sd_bus_message *m, const char *field, const c } if (explicit_path) { - r = extract_first_word(&eq, &path, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE); + r = extract_first_word(&eq, &path, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE); if (r < 0) return log_error_errno(r, "Failed to parse path: %m"); } - r = strv_split_extract(&l, eq, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE); + r = strv_split_extract(&l, eq, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE); if (r < 0) return log_error_errno(r, "Failed to parse command line: %m"); @@ -440,13 +440,13 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons if (streq(field, "DisableControllers")) - return bus_append_strv(m, "DisableControllers", eq, EXTRACT_QUOTES); + return bus_append_strv(m, "DisableControllers", eq, EXTRACT_UNQUOTE); if (streq(field, "Delegate")) { r = parse_boolean(eq); if (r < 0) - return bus_append_strv(m, "DelegateControllers", eq, EXTRACT_QUOTES); + return bus_append_strv(m, "DelegateControllers", eq, EXTRACT_UNQUOTE); r = sd_bus_message_append(m, "(sv)", "Delegate", "b", r); if (r < 0) @@ -819,7 +819,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con "RuntimeDirectory", "StateDirectory", "CacheDirectory", "LogsDirectory", "ConfigurationDirectory", "SupplementaryGroups", "SystemCallArchitectures")) - return bus_append_strv(m, field, eq, EXTRACT_QUOTES); + return bus_append_strv(m, field, eq, EXTRACT_UNQUOTE); if (STR_IN_SET(field, "SyslogLevel", "LogLevelMax")) @@ -881,7 +881,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con if (STR_IN_SET(field, "Environment", "UnsetEnvironment", "PassEnvironment")) - return bus_append_strv(m, field, eq, EXTRACT_QUOTES|EXTRACT_CUNESCAPE); + return bus_append_strv(m, field, eq, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE); if (streq(field, "EnvironmentFile")) { @@ -1125,7 +1125,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con for (;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -1212,7 +1212,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con bool ignore_enoent = false; uint64_t flags = MS_REC; - r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_QUOTES|EXTRACT_DONT_COALESCE_SEPARATORS); + r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS); if (r < 0) return log_error_errno(r, "Failed to parse argument: %m"); if (r == 0) @@ -1225,7 +1225,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con } if (p && p[-1] == ':') { - r = extract_first_word(&p, &destination, ":" WHITESPACE, EXTRACT_QUOTES|EXTRACT_DONT_COALESCE_SEPARATORS); + r = extract_first_word(&p, &destination, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS); if (r < 0) return log_error_errno(r, "Failed to parse argument: %m"); if (r == 0) @@ -1238,7 +1238,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con if (p && p[-1] == ':') { _cleanup_free_ char *options = NULL; - r = extract_first_word(&p, &options, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &options, NULL, EXTRACT_UNQUOTE); if (r < 0) return log_error_errno(r, "Failed to parse argument: %m"); @@ -1297,7 +1297,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con _cleanup_free_ char *word = NULL, *path = NULL; const char *w; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r < 0) return log_error_errno(r, "Failed to parse argument: %m"); if (r == 0) @@ -1446,7 +1446,7 @@ static int bus_append_service_property(sd_bus_message *m, const char *field, con _cleanup_free_ char *word = NULL; int val; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) break; if (r == -ENOMEM) @@ -1566,7 +1566,7 @@ static int bus_append_socket_property(sd_bus_message *m, const char *field, cons if (streq(field, "Symlinks")) - return bus_append_strv(m, field, eq, EXTRACT_QUOTES); + return bus_append_strv(m, field, eq, EXTRACT_UNQUOTE); if (streq(field, "SocketProtocol")) @@ -1684,7 +1684,7 @@ static int bus_append_unit_property(sd_bus_message *m, const char *field, const if (unit_dependency_from_string(field) >= 0 || STR_IN_SET(field, "Documentation", "RequiresMountsFor")) - return bus_append_strv(m, field, eq, EXTRACT_QUOTES); + return bus_append_strv(m, field, eq, EXTRACT_UNQUOTE); t = condition_type_from_string(field); if (t >= 0) diff --git a/src/shared/condition.c b/src/shared/condition.c index 56e530a57d..a54323a55a 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -114,7 +114,7 @@ static int condition_test_kernel_command_line(Condition *c) { _cleanup_free_ char *word = NULL; bool found; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX); if (r < 0) return r; if (r == 0) diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index f45dd798b2..c27c499eda 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -758,7 +758,7 @@ int config_parse_strv( for (;;) { char *word = NULL; - r = extract_first_word(&rvalue, &word, NULL, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE); + r = extract_first_word(&rvalue, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE); if (r == 0) break; if (r == -ENOMEM) diff --git a/src/shared/cpu-set-util.c b/src/shared/cpu-set-util.c index f27543dfe2..219314ef58 100644 --- a/src/shared/cpu-set-util.c +++ b/src/shared/cpu-set-util.c @@ -155,7 +155,7 @@ int parse_cpu_set_full( unsigned cpu_lower, cpu_upper; int r; - r = extract_first_word(&p, &word, WHITESPACE ",", EXTRACT_QUOTES); + r = extract_first_word(&p, &word, WHITESPACE ",", EXTRACT_UNQUOTE); if (r == -ENOMEM) return warn ? log_oom() : -ENOMEM; if (r < 0) diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 9129ad5f6b..de9e35b128 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -505,7 +505,7 @@ int mount_option_mangle( _cleanup_free_ char *word = NULL; const struct libmnt_optmap *ent; - r = extract_first_word(&p, &word, ",", EXTRACT_QUOTES); + r = extract_first_word(&p, &word, ",", EXTRACT_UNQUOTE); if (r < 0) return r; if (r == 0) diff --git a/src/shared/securebits-util.c b/src/shared/securebits-util.c index 6d31dfeff0..b2abaf4f52 100644 --- a/src/shared/securebits-util.c +++ b/src/shared/securebits-util.c @@ -42,7 +42,7 @@ int secure_bits_from_string(const char *s) { for (p = s;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE); if (r == -ENOMEM) return r; if (r <= 0) diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 843c3837d1..990a2f927b 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -1390,7 +1390,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { /* Parse columns */ p = buffer; - r = extract_many_words(&p, NULL, EXTRACT_QUOTES, + r = extract_many_words(&p, NULL, EXTRACT_UNQUOTE, &action, &name, &id, &description, &home, &shell, NULL); if (r < 0) return log_error_errno(r, "[%s:%u] Syntax error.", fname, line); diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 28f8ab301b..175e4a2393 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -322,7 +322,7 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co for (;;) { _cleanup_free_ char *word = NULL, *m = NULL; - r = extract_first_word(&text, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX); + r = extract_first_word(&text, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX); if (r < 0) return log_error_errno(r, "[%s:%u] Failed to parse word from provides string: %m", s->path, line); if (r == 0) @@ -391,7 +391,7 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text _cleanup_free_ char *word = NULL, *m = NULL; bool is_before; - r = extract_first_word(&text, &word, NULL, EXTRACT_QUOTES|EXTRACT_RELAX); + r = extract_first_word(&text, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX); if (r < 0) return log_error_errno(r, "[%s:%u] Failed to parse word from provides string: %m", s->path, line); if (r == 0) diff --git a/src/test/test-extract-word.c b/src/test/test-extract-word.c index 30019382ae..f148b3e6f1 100644 --- a/src/test/test-extract-word.c +++ b/src/test/test-extract-word.c @@ -43,12 +43,12 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "\"foobar\" \'waldo\'"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) > 0); assert_se(streq(t, "foobar")); free(t); assert_se(p == original + 9); - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) > 0); assert_se(streq(t, "waldo")); free(t); assert_se(isempty(p)); @@ -64,7 +64,7 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "\""; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) == -EINVAL); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) == -EINVAL); assert_se(p == original + 1); p = original = "\'"; @@ -74,7 +74,7 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "\'"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) == -EINVAL); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) == -EINVAL); assert_se(p == original + 1); p = original = "\'fooo"; @@ -84,17 +84,17 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "\'fooo"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) == -EINVAL); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) == -EINVAL); assert_se(p == original + 5); p = original = "\'fooo"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX) > 0); assert_se(streq(t, "fooo")); free(t); assert_se(isempty(p)); p = original = "\"fooo"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX) > 0); assert_se(streq(t, "fooo")); free(t); assert_se(isempty(p)); @@ -106,7 +106,7 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "yay\'foo\'bar"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) > 0); assert_se(streq(t, "yayfoobar")); free(t); assert_se(isempty(p)); @@ -135,7 +135,7 @@ static void test_extract_first_word(void) { free(t); assert_se(p == original + 13); - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE) > 0); assert_se(streq(t, "pi\360\237\222\251le")); free(t); assert_se(isempty(p)); @@ -169,7 +169,7 @@ static void test_extract_first_word(void) { assert_se(p == original + 5); p = original = "\"foo\\"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX) > 0); assert_se(streq(t, "foo")); free(t); assert_se(isempty(p)); @@ -205,17 +205,17 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "\"foo\\"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE_RELAX) == -EINVAL); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE_RELAX) == -EINVAL); assert_se(p == original + 5); p = original = "\"foo\\"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE_RELAX|EXTRACT_RELAX) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE_RELAX|EXTRACT_RELAX) > 0); assert_se(streq(t, "foo\\")); free(t); assert_se(isempty(p)); p = original = "\"foo\\"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE|EXTRACT_CUNESCAPE_RELAX|EXTRACT_RELAX) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE|EXTRACT_CUNESCAPE_RELAX|EXTRACT_RELAX) > 0); assert_se(streq(t, "foo\\")); free(t); assert_se(isempty(p)); @@ -265,12 +265,12 @@ static void test_extract_first_word(void) { assert_se(isempty(p)); p = original = "-N ''"; - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) > 0); assert_se(streq(t, "-N")); free(t); assert_se(p == original + 3); - assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES) > 0); + assert_se(extract_first_word(&p, &t, NULL, EXTRACT_UNQUOTE) > 0); assert_se(streq(t, "")); free(t); assert_se(isempty(p)); @@ -340,12 +340,12 @@ static void test_extract_first_word_and_warn(void) { assert_se(isempty(p)); p = original = "\"foobar\" \'waldo\'"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) > 0); assert_se(streq(t, "foobar")); free(t); assert_se(p == original + 9); - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) > 0); assert_se(streq(t, "waldo")); free(t); assert_se(isempty(p)); @@ -355,19 +355,19 @@ static void test_extract_first_word_and_warn(void) { assert_se(isempty(p)); p = original = "\""; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) == -EINVAL); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) == -EINVAL); assert_se(p == original + 1); p = original = "\'"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) == -EINVAL); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) == -EINVAL); assert_se(p == original + 1); p = original = "\'fooo"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) == -EINVAL); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) == -EINVAL); assert_se(p == original + 5); p = original = "\'fooo"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); assert_se(streq(t, "fooo")); free(t); assert_se(isempty(p)); @@ -390,7 +390,7 @@ static void test_extract_first_word_and_warn(void) { free(t); assert_se(p == original + 13); - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE, NULL, "fake", 1, original) > 0); assert_se(streq(t, "pi\360\237\222\251le")); free(t); assert_se(isempty(p)); @@ -414,21 +414,21 @@ static void test_extract_first_word_and_warn(void) { assert_se(isempty(p)); p = original = "\"foo\\"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES, NULL, "fake", 1, original) == -EINVAL); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE, NULL, "fake", 1, original) == -EINVAL); assert_se(p == original + 5); p = original = "\"foo\\"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); assert_se(streq(t, "foo")); free(t); assert_se(isempty(p)); p = original = "\"foo\\"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, NULL, "fake", 1, original) == -EINVAL); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE, NULL, "fake", 1, original) == -EINVAL); assert_se(p == original + 5); p = original = "\"foo\\"; - assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); + assert_se(extract_first_word_and_warn(&p, &t, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE|EXTRACT_RELAX, NULL, "fake", 1, original) > 0); assert_se(streq(t, "foo")); free(t); assert_se(isempty(p)); @@ -488,7 +488,7 @@ static void test_extract_many_words(void) { free(b); p = original = "'foobar' wa\"ld\"i "; - assert_se(extract_many_words(&p, NULL, EXTRACT_QUOTES, &a, &b, &c, NULL) == 2); + assert_se(extract_many_words(&p, NULL, EXTRACT_UNQUOTE, &a, &b, &c, NULL) == 2); assert_se(isempty(p)); assert_se(streq_ptr(a, "foobar")); assert_se(streq_ptr(b, "waldi")); diff --git a/src/test/test-string-util.c b/src/test/test-string-util.c index 064a5abdac..f7dde618d3 100644 --- a/src/test/test-string-util.c +++ b/src/test/test-string-util.c @@ -380,7 +380,7 @@ static void check(const char *test, char** expected, bool trailing) { for (;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&test, &word, NULL, EXTRACT_QUOTES); + r = extract_first_word(&test, &word, NULL, EXTRACT_UNQUOTE); if (r == 0) { assert_se(!trailing); break; diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 18ad03669c..488025f23a 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -204,7 +204,7 @@ static void test_strv_unquote(const char *quoted, char **list) { char **t; int r; - r = strv_split_extract(&s, quoted, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&s, quoted, WHITESPACE, EXTRACT_UNQUOTE); assert_se(r == (int) strv_length(list)); assert_se(s); j = strv_join(s, " | "); @@ -221,7 +221,7 @@ static void test_invalid_unquote(const char *quoted) { char **s = NULL; int r; - r = strv_split_extract(&s, quoted, WHITESPACE, EXTRACT_QUOTES); + r = strv_split_extract(&s, quoted, WHITESPACE, EXTRACT_UNQUOTE); assert_se(s == NULL); assert_se(r == -EINVAL); } diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 7b091006ea..b8ee856a15 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -923,7 +923,7 @@ static int parse_xattrs_from_arg(Item *i) { for (;;) { _cleanup_free_ char *name = NULL, *value = NULL, *xattr = NULL; - r = extract_first_word(&p, &xattr, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE); + r = extract_first_word(&p, &xattr, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE); if (r < 0) log_warning_errno(r, "Failed to parse extended attribute '%s', ignoring: %m", p); if (r <= 0) @@ -2502,7 +2502,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool r = extract_many_words( &buffer, NULL, - EXTRACT_QUOTES, + EXTRACT_UNQUOTE, &action, &path, &mode, |