mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-19 07:40:42 +01:00
ifcfg: also ANSIC escape DEL character in ifcfg writer
This is like using nm_ascii_is_ctrl_or_del() instead of
nm_ascii_is_ctrl() in the previous version of the patch.
We thus now always will switch to ANSIC escaping if we see
a ASCII DEL character. That is probable desirable, but either
way should not make a big difference (because we can parse
the DEL character both in regular quotation and in ANSIC quotation).
The patch is however larger, to also take the opportunity to only check
for nm_ascii_is_regular() in the "fast path". The behavior is the same
as changing nm_ascii_is_ctrl() to nm_ascii_is_ctrl_or_del().
(cherry picked from commit fc2f758af5)
This commit is contained in:
parent
9e40072fd0
commit
8d70dd5477
1 changed files with 8 additions and 7 deletions
|
|
@ -262,13 +262,14 @@ svEscape(const char *s, char **to_free)
|
|||
mangle++;
|
||||
else if (_char_req_quotes(s[slen]))
|
||||
requires_quotes = TRUE;
|
||||
else if (nm_ascii_is_ctrl(s[slen])) {
|
||||
/* if the string contains newline we can only express it using ANSI C quotation
|
||||
* (as we don't support line continuation).
|
||||
* Additionally, ANSI control characters look odd with regular quotation, so handle
|
||||
* them too. */
|
||||
return (*to_free = _escape_ansic(s));
|
||||
} else if (nm_ascii_is_non_ascii(s[slen])) {
|
||||
else if (!nm_ascii_is_regular(s[slen])) {
|
||||
if (nm_ascii_is_ctrl_or_del(s[slen])) {
|
||||
/* if the string contains newline we can only express it using ANSI C quotation
|
||||
* (as we don't support line continuation).
|
||||
* Additionally, ANSI control characters look odd with regular quotation, so handle
|
||||
* them too. */
|
||||
return (*to_free = _escape_ansic(s));
|
||||
}
|
||||
all_ascii = FALSE;
|
||||
requires_quotes = TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue