diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-07-31 16:21:14 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-09 09:34:55 +0200 |
commit | 0645b83a40d1c782f173c4d8440ab2fc82a75006 (patch) | |
tree | 03c9733aec1d24b4ae6578c14f8ef01b107a6900 /src/xdg-autostart-generator/xdg-autostart-service.c | |
parent | test-string-util: stop testing FOREACH_WORD (diff) | |
download | systemd-0645b83a40d1c782f173c4d8440ab2fc82a75006.tar.xz systemd-0645b83a40d1c782f173c4d8440ab2fc82a75006.zip |
tree-wide: replace strv_split_full() with strv_split_extract() everywhere
Behaviour is not identical, as shown by the tests in test-strv.
The combination of EXTRACT_UNQUOTE without EXTRACT_RELAX only appears in
the test, so it doesn't seem particularly important. OTOH, the difference
in handling of squished parameters could make a difference. New behaviour
is what both bash and python do, so I think we can ignore this corner case.
This change has the following advantages:
- the duplication of code paths that do a very similar thing is removed
- extract_one_word() / strv_split_extract() return a proper error code.
Diffstat (limited to 'src/xdg-autostart-generator/xdg-autostart-service.c')
-rw-r--r-- | src/xdg-autostart-generator/xdg-autostart-service.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xdg-autostart-generator/xdg-autostart-service.c b/src/xdg-autostart-generator/xdg-autostart-service.c index 4a30f9e4335..efd2ae3ec62 100644 --- a/src/xdg-autostart-generator/xdg-autostart-service.c +++ b/src/xdg-autostart-generator/xdg-autostart-service.c @@ -385,9 +385,9 @@ int xdg_autostart_format_exec_start( * NOTE: Technically, XDG only specifies " as quotes, while this also * accepts '. */ - exec_split = strv_split_full(exec, WHITESPACE, SPLIT_QUOTES | SPLIT_RELAX); - if (!exec_split) - return -ENOMEM; + r = strv_split_extract(&exec_split, exec, NULL, EXTRACT_UNQUOTE | EXTRACT_RELAX); + if (r < 0) + return r; if (strv_isempty(exec_split)) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Exec line is empty"); |