Handle escape characters in interface name

Updated the patch as per review comments.
This commit is contained in:
Gaurav 2020-12-15 12:58:52 +05:30 committed by Zbigniew Jędrzejewski-Szmek
parent 17f8a21fd0
commit 6ef03f7a0d
1 changed files with 8 additions and 1 deletions

View File

@ -92,7 +92,14 @@ bool interface_name_is_valid(const char *p) {
*q == '_';
if (!good) {
log_debug("The interface %s is invalid as it contains special character %c", p, *q);
if (DEBUG_LOGGING) {
_cleanup_free_ char *iface = NULL;
iface = cescape(p);
if (!iface)
log_oom();
else
log_debug("The interface %s is invalid as it contains special character %c", iface, *q);
}
return false;
}