Commit a4c22636 authored by Michael Tremer's avatar Michael Tremer

export: Don't fail when output stream isn't seekable

For the ipset format, we will rewrite the header after we know the total
number of entries that have been written in order to optimise the hash
table.

When the output stream isn't seekable, we cannot write the header again
which is being fixed in this patch.

Fixes: #12885
Reported-by: default avatarJon Murphy <jon.murphy@ipfire.org>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 846d4188
......@@ -181,7 +181,12 @@ class IpsetOutputWriter(OutputWriter):
def _write_footer(self):
# Jump back to the beginning of the file
self.f.seek(0)
try:
self.f.seek(0)
# If the output stream isn't seekable, we won't try writing the header again
except io.UnsupportedOperation:
return
# Rewrite the header with better configuration
self._write_header()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment