]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
util: Don't use "\e"
authorBernhard Walle <bernhard@bwalle.de>
Tue, 16 Sep 2014 19:20:47 +0000 (21:20 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 28 Sep 2014 16:16:32 +0000 (19:16 +0300)
'\e' representing ESC (0x1b) is not C standard, it's an GNU extension.
https://gcc.gnu.org/onlinedocs/gcc/Character-Escapes.html#Character-Escapes

Since the code also compiles on Windows with Microsoft compiler, we
should use '\033' instead.

Note: I didn't try to build the whole wpa_supplicant on Windows, so I
don't know if it still builds (I have no Visual Studio 2005 for a quick
test). I just needed the string conversion routines for the P"" syntax
in both directions.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
src/utils/common.c

index c740830f09a00c609d3c2f44c066dd5d4873ea2b..78d196e9c2d46ff9a05c5b1ff215ea9d02e8aa5c 100644 (file)
@@ -362,7 +362,7 @@ void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len)
                        *txt++ = '\\';
                        *txt++ = '\\';
                        break;
-               case '\e':
+               case '\033':
                        *txt++ = '\\';
                        *txt++ = 'e';
                        break;
@@ -427,7 +427,7 @@ size_t printf_decode(u8 *buf, size_t maxlen, const char *str)
                                pos++;
                                break;
                        case 'e':
-                               buf[len++] = '\e';
+                               buf[len++] = '\033';
                                pos++;
                                break;
                        case 'x':