Make sure tempdir is created even in offline mode. (RHBZ#1305175)

This commit is contained in:
Jiri Popelka 2016-02-08 14:12:25 +01:00
parent b2398523d9
commit e253f94325
3 changed files with 32 additions and 59 deletions

View File

@ -1,58 +0,0 @@
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

@ -0,0 +1,26 @@
From 7c6b91b1c32fe502d1a6ffc3e29f09481bcf7ab1 Mon Sep 17 00:00:00 2001
From: Jiri Popelka <jpopelka@redhat.com>
Date: Mon, 8 Feb 2016 13:42:41 +0100
Subject: [PATCH 1/2] Make sure tempdir is created even in offline mode.
---
src/firewall/functions.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/firewall/functions.py b/src/firewall/functions.py
index 9b19139..6dbac26 100644
--- a/src/firewall/functions.py
+++ b/src/firewall/functions.py
@@ -265,6 +265,9 @@ def firewalld_is_active():
def tempFile():
try:
+ if not os.path.exists(FIREWALLD_TEMPDIR):
+ os.mkdir(FIREWALLD_TEMPDIR, 0o750)
+
return tempfile.NamedTemporaryFile(mode='wt', prefix="temp.",
dir=FIREWALLD_TEMPDIR, delete=False)
except Exception as msg:
--
2.5.0

View File

@ -8,7 +8,7 @@
Summary: A firewall daemon with D-Bus interface providing a dynamic firewall
Name: firewalld
Version: 0.4.0
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://www.firewalld.org
License: GPLv2+
Source0: https://fedorahosted.org/released/firewalld/%{name}-%{version}.tar.bz2
@ -18,6 +18,7 @@ Source2: FedoraWorkstation.xml
%endif
%if 0%{?fedora}
Patch0: firewalld-0.2.6-MDNS-default.patch
Patch1: firewalld-0.4.0-tempdir_RHBZ1305175.patch
%endif
BuildArch: noarch
BuildRequires: desktop-file-utils
@ -172,6 +173,7 @@ Workstation product specific firewalld configuration settings.
%setup -q
%if 0%{?fedora}
%patch0 -p1
%patch1 -p1
%endif
%if 0%{?with_python3}
@ -484,6 +486,9 @@ fi
%endif
%changelog
* Mon Feb 08 2016 Jiri Popelka <jpopelka@redhat.com> - 0.4.0-2
- Make sure tempdir is created even in offline mode. (RHBZ#1305175)
* Mon Feb 1 2016 Thomas Woerner <twoerner@redhat.com> - 0.4.0-1
- Version 0.4.0
- Speed ups