Merge pull request #20157 from keszybz/numerical-uids-in--M

Allow numerical UIDs in systemctl -M uid@ and similar
This commit is contained in:
Luca Boccassi
2021-07-09 16:58:45 +01:00
committed by GitHub
7 changed files with 112 additions and 74 deletions
+21
View File
@@ -8,6 +8,7 @@
#include "escape.h"
#include "hexdecoct.h"
#include "macro.h"
#include "strv.h"
#include "utf8.h"
int cescape_char(char c, char *buf) {
@@ -542,3 +543,23 @@ char* shell_maybe_quote(const char *s, ShellEscapeFlags flags) {
return str_realloc(buf);
}
char* quote_command_line(char **argv) {
_cleanup_free_ char *result = NULL;
assert(argv);
char **a;
STRV_FOREACH(a, argv) {
_cleanup_free_ char *t = NULL;
t = shell_maybe_quote(*a, SHELL_ESCAPE_EMPTY);
if (!t)
return NULL;
if (!strextend_with_separator(&result, " ", t))
return NULL;
}
return TAKE_PTR(result);
}
+1
View File
@@ -68,3 +68,4 @@ char* escape_non_printable_full(const char *str, size_t console_width, XEscapeFl
char* shell_escape(const char *s, const char *bad);
char* shell_maybe_quote(const char *s, ShellEscapeFlags flags);
char* quote_command_line(char **argv);