]> 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>
Fri, 8 Feb 2019 06:21:27 +0000 (07:21 +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 2d678549ad08bfe91bb4fc47d2820e41687d7b3b..cfe303671b9e214bd9475b6d768e9d983de5199b 100755 (executable)
@@ -169,7 +169,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(