]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
issue 2795: python 3 fix in Rust C header gen
authorJason Ish <ish@unx.ca>
Thu, 7 Feb 2019 19:53:23 +0000 (13:53 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 16 Feb 2019 13:58:18 +0000 (14:58 +0100)
The C header generation script was failing with a unicode error
in Python 3 on FreeBSD.  Fix the reading of files to properly
handle unicode in all Python 3 environments.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2794

rust/gen-c-headers.py

index ba7ce7defd96e5d17450547c00bc6c7f6a72dc29..f0c6e32e48e70acb551943de8b7e73a5f648f1ba 100755 (executable)
@@ -156,7 +156,7 @@ def gen_headers(filename):
     if not should_regen(filename, output_filename):
         return
 
-    buf = open(filename).read()
+    buf = open(filename, "rb").read().decode("utf-8")
     writer = StringIO()
 
     for fn in re.findall(