diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-18 11:41:03 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-18 11:41:03 +0100 |
| commit | c75b80bf6116d2aa6020b1f7596bf025532cb7a6 (patch) | |
| tree | fe537eb9ec7abdb4a385a4e34c21f9fdd3097067 | |
| parent | 04857caf1a456e1204aff91b800d6c8c797c42f2 (diff) | |
Escape \ and " when writing .config entries for strings.
| -rw-r--r-- | kconfiglib.py | 5 |
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)] |
