mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-19 01:50:48 +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().
This commit is contained in:
parent
6841bb1b26
commit
fc2f758af5
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