summaryrefslogtreecommitdiffstats
path: root/lib/pyinotify.py
diff options
context:
space:
mode:
authorFrazer Clews <frazer.clews@codethink.co.uk>2020-01-16 17:11:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-19 13:30:58 +0000
commitb809a6812aa15a8a9af97bc382cc4b19571e6bfc (patch)
tree2558aa5cbbf8807b56968fdd1a2850a65aa897b7 /lib/pyinotify.py
parent4367692a932ac135c5aa4f9f2a4e4f0150f76697 (diff)
downloadbitbake-b809a6812aa15a8a9af97bc382cc4b19571e6bfc.tar.gz
lib: amend code to use proper singleton comparisons where possible
amend the code to handle singleton comparisons properly so it only checks if they only refer to the same object or not, and not bother comparing the values. Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/pyinotify.py')
-rw-r--r--lib/pyinotify.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pyinotify.py b/lib/pyinotify.py
index 1528a22e8..6ae40a2d7 100644
--- a/lib/pyinotify.py
+++ b/lib/pyinotify.py
@@ -1274,7 +1274,7 @@ class Notifier:
basename = os.path.basename(sys.argv[0]) or 'pyinotify'
pid_file = os.path.join(dirname, basename + '.pid')
- if pid_file != False and os.path.lexists(pid_file):
+ if pid_file and os.path.lexists(pid_file):
err = 'Cannot daemonize: pid file %s already exists.' % pid_file
raise NotifierError(err)
@@ -1308,7 +1308,7 @@ class Notifier:
fork_daemon()
# Write pid
- if pid_file != False:
+ if pid_file:
flags = os.O_WRONLY|os.O_CREAT|os.O_NOFOLLOW|os.O_EXCL
fd_pid = os.open(pid_file, flags, 0o0600)
os.write(fd_pid, bytes(str(os.getpid()) + '\n',