summaryrefslogtreecommitdiff
path: root/app-misc/binwalk/files/binwalk-2.3.3-syntax-fix.patch
blob: 5edd530b22932ad9195aab1dd4bc4a8f55d2639b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
https://github.com/ReFirmLabs/binwalk/pull/585

From bce53d1bb57c2e6dccf718147ebe9472779b7903 Mon Sep 17 00:00:00 2001
From: Cameron Katri <me@cameronkatri.com>
Date: Mon, 3 Jan 2022 15:20:39 -0500
Subject: [PATCH] Fix SyntaxWarning message

/usr/lib/python3/dist-packages/binwalk/modules/extractor.py:969: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if child_pid is 0:
/usr/lib/python3/dist-packages/binwalk/modules/extractor.py:984: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if child_pid is 0:
--- a/src/binwalk/modules/extractor.py
+++ b/src/binwalk/modules/extractor.py
@@ -966,7 +966,7 @@ def shell_call(self, command):
             
             # Fork a child process
             child_pid = os.fork()
-            if child_pid is 0:
+            if child_pid == 0:
                 # Switch to the run-as user privileges, if one has been set
                 if self.runas_uid is not None and self.runas_gid is not None:
                     os.setgid(self.runas_uid)
@@ -981,10 +981,10 @@ def shell_call(self, command):
             rval = subprocess.call(shlex.split(command), stdout=tmp, stderr=tmp)
 
         # A true child process should exit with the subprocess exit value
-        if child_pid is 0:
+        if child_pid == 0:
             sys.exit(rval)
         # If no os.fork() happened, just return the subprocess exit value
-        elif child_pid is None:
+        elif child_pid == None:
             return rval
         # Else, os.fork() happened and we're the parent. Wait and return the child's exit value.
         else: