summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-07-25 19:09:22 +0300
committerIlya Maximets <i.maximets@samsung.com>2019-07-25 19:43:46 +0300
commit29004db273985088cdb60097bdfd4a6bc6a966d1 (patch)
tree90baf6eedaff9f955ef9312b2cc3dfeb70dd8347 /lib
parentd560bc1baa522e3c101d3740ecfb17b7723df83d (diff)
downloadopenvswitch-29004db273985088cdb60097bdfd4a6bc6a966d1.tar.gz
ovsdb-data: Don't put strings with digits in quotes.
No need to use quotes for strings like "br0". Keeping UUIDs always in quotes to avoid different treatment of those that starts with digits and those that starts with letters. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ovsdb-data.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index b0fb20d31..4828624f6 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -674,6 +674,7 @@ string_needs_quotes(const char *s)
{
const char *p = s;
unsigned char c;
+ struct uuid uuid;
c = *p++;
if (!isalpha(c) && c != '_') {
@@ -681,7 +682,7 @@ string_needs_quotes(const char *s)
}
while ((c = *p++) != '\0') {
- if (!isalpha(c) && c != '_' && c != '-' && c != '.') {
+ if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.') {
return true;
}
}
@@ -690,6 +691,10 @@ string_needs_quotes(const char *s)
return true;
}
+ if (uuid_from_string(&uuid, s)) {
+ return true;
+ }
+
return false;
}