Skip to content

Commit d5bb140

Browse files
committed
lib/pycriu/criu.py: prevent always appending "Unknown" to error messages
Regardless of the actual error message, "Unknown" was always appended to the end of the string, resulting in messages like: "DUMP failed: Error(3): No process with such pidUnknown". Fixed by changing standalone if statements to else-if blocks so "Unknown" is only added when no specific error condition matches. Signed-off-by: Andrii Herheliuk <andrii@herheliuk.com>
1 parent 7e70948 commit d5bb140

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/pycriu/criu.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@ def _gen_error_str(self):
181181
if self.errno == errno.EBADRQC:
182182
s += "Bad options"
183183

184-
if self.typ == rpc.DUMP:
185-
if self.errno == errno.ESRCH:
186-
s += "No process with such pid"
184+
elif self.typ == rpc.DUMP and self.errno == errno.ESRCH:
185+
s += "No process with such pid"
187186

188-
if self.typ == rpc.RESTORE:
189-
if self.errno == errno.EEXIST:
190-
s += "Process with requested pid already exists"
187+
elif self.typ == rpc.RESTORE and self.errno == errno.EEXIST:
188+
s += "Process with requested pid already exists"
191189

192-
s += "Unknown"
190+
else:
191+
s += "Unknown"
193192

194193
return s
195194

0 commit comments

Comments
 (0)