diff --git a/rhnsd.c b/rhnsd.c
index ad2100d..493aac0 100644
--- a/rhnsd.c
+++ b/rhnsd.c
@@ -310,8 +310,12 @@ static int write_pid (const char *file)
FILE *fp;
fp = fopen (file, "w");
- if (fp == NULL)
- return -1;
+ if (fp == NULL) {
+ return -1;
+ } else if (chmod (file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) != 0) {
+ fclose(fp);
+ return -1;
+ }
fprintf (fp, "%d\n", getpid ());
if (fflush (fp) || ferror (fp)) {
diff --git a/rhnsd.spec b/rhnsd.spec
index 333a555..8ef3a39 100644
--- a/rhnsd.spec
+++ b/rhnsd.spec
@@ -5,7 +5,7 @@ Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.
URL: https://fedorahosted.org/spacewalk
Name: rhnsd
Version: 5.0.13
-Release: 7%{?dist}
+Release: 7.1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext
@@ -138,6 +138,9 @@ rm -fr $RPM_BUILD_ROOT
%doc LICENSE
%changelog
+* Tue Sep 12 2017 Gennadii Altukhov <galt@redhat.com> 5.0.13-7.1
+- Resolves: #1489119 - change permissions for rhnsd.pid (galt@redhat.com)
+
* Mon Mar 06 2017 Gennadii Altukhov <galt@redhat.com> 5.0.13-7
- Resolves: #1409562 - fix BZ IDs in spec file (galt@redhat.com)