summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-18 11:41:03 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-18 11:41:03 +0100
commitc75b80bf6116d2aa6020b1f7596bf025532cb7a6 (patch)
treefe537eb9ec7abdb4a385a4e34c21f9fdd3097067 /kconfiglib.py
parent04857caf1a456e1204aff91b800d6c8c797c42f2 (diff)
Escape \ and " when writing .config entries for strings.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index d22ec75..5cb36b5 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -2943,7 +2943,10 @@ class Symbol(Item, _HasVisibility):
return ["# CONFIG_{0} is not set".format(self.name)]
elif self.type == STRING:
- return ['CONFIG_{0}="{1}"'.format(self.name, val)]
+ # Escape \ and "
+ return ['CONFIG_{0}="{1}"'
+ .format(self.name,
+ val.replace("\\", "\\\\").replace('"', '\\"'))]
elif self.type == INT or self.type == HEX:
return ["CONFIG_{0}={1}".format(self.name, val)]