system-config-printer/0009-Fix-compatibility-with-python3-in-putFile-method.patch

31 lines
915 B
Diff

From 9fb1f6a731dab0c39ba138d29f310622d4f32d4d Mon Sep 17 00:00:00 2001
From: Tomas Korbar <tkorbar@redhat.com>
Date: Mon, 14 Jan 2019 16:09:25 +0100
Subject: [PATCH] Fix compatibility with python3 in putFile method
in python3 os.read returns byte object not a string which caused
writing loop to be endless
by adding b'' comparison we hold compatibility both with python2
and python3
---
cupspk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cupspk.py b/cupspk.py
index 5b863b43..b7cbc0b3 100644
--- a/cupspk.py
+++ b/cupspk.py
@@ -448,7 +448,7 @@ class Connection:
if fd is not None:
os.lseek (fd, 0, os.SEEK_SET)
buf = os.read (fd, 512)
- while buf != '':
+ while buf != '' and buf != b'':
os.write (tmpfd, buf)
buf = os.read (fd, 512)
else:
--
2.33.0