- Fixed 'pid_file' referenced before assignment (RHBZ#1233232)

This commit is contained in:
Thomas Woerner 2015-06-18 17:54:59 +02:00
parent a852a77a23
commit 400c17b1f3
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,58 @@
commit 3a1f22c95bb5723456533de5aa821143682b8e3d
Author: Thomas Woerner <twoerner@redhat.com>
Date: Thu Jun 18 16:55:40 2015 +0200
firewalld: Fixed 'pid_file' referenced before assignment (RHBZ#1233232)
diff --git a/src/firewalld b/src/firewalld
index 2db71a8..bd81316 100755
--- a/src/firewalld
+++ b/src/firewalld
@@ -82,6 +82,7 @@ def setup_logging(args):
log.addDebugLogging("*", log.stdout)
def startup(args):
+ pid_file = "/var/run/firewalld.pid"
try:
if not args.nofork:
# do the UNIX double-fork magic, see Stevens' "Advanced
@@ -119,7 +120,6 @@ def startup(args):
if not args.nopid:
# write the pid file
- pid_file = "/var/run/firewalld.pid"
with open(pid_file, "w") as f:
f.write(str(os.getpid()))
@@ -128,27 +128,27 @@ def startup(args):
server.run_server(args.debug_gc)
# Clean up on exit
- if os.path.exists(pid_file) and not args.nopid:
+ if not args.nopid and os.path.exists(pid_file):
os.remove(pid_file)
except OSError as e:
log.fatal(_("Fork #1 failed: %d (%s)") % (e.errno, e.strerror))
log.error(traceback.format_exc())
- if os.path.exists(pid_file) and not args.nopid:
+ if not args.nopid and os.path.exists(pid_file):
os.remove(pid_file)
sys.exit(1)
except dbus.exceptions.DBusException as e:
log.fatal(str(e))
log.error(traceback.format_exc())
- if os.path.exists(pid_file) and not args.nopid:
+ if not args.nopid and os.path.exists(pid_file):
os.remove(pid_file)
sys.exit(1)
except IOError as e:
log.fatal(str(e))
log.error(traceback.format_exc())
- if os.path.exists(pid_file) and not args.nopid:
+ if not args.nopid and os.path.exists(pid_file):
os.remove(pid_file)
sys.exit(1)

View File

@ -8,7 +8,7 @@
Summary: A firewall daemon with D-Bus interface providing a dynamic firewall
Name: firewalld
Version: 0.3.14.2
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://www.firewalld.org
License: GPLv2+
Source0: https://fedorahosted.org/released/firewalld/%{name}-%{version}.tar.bz2
@ -19,6 +19,7 @@ Source2: FedoraWorkstation.xml
%if 0%{?fedora}
Patch0: firewalld-0.2.6-MDNS-default.patch
%endif
Patch1: firewalld-0.3.14.2-pid_file_RHBZ#1233232.patch
BuildArch: noarch
BuildRequires: desktop-file-utils
BuildRequires: gettext
@ -167,6 +168,7 @@ Workstation product specific firewalld configuration settings.
%if 0%{?fedora}
%patch0 -p1
%endif
%patch1 -p1
%if 0%{?with_python3}
rm -rf %{py3dir}
@ -474,6 +476,9 @@ fi
%endif
%changelog
* Thu Jun 18 2015 Thomas Woerner <twoerner@redhat.com> - 0.3.14.2-2
- Fixed 'pid_file' referenced before assignment (RHBZ#1233232)
* Wed Jun 17 2015 Thomas Woerner <twoerner@redhat.com> - 0.3.14.2-1
- reunification of the firewalld spec files for all Fedora releases
- fix dependencies for -applet and -config: use_python3 is the proper switch