Blame SOURCES/rhnsd-5.0.13-8-el7-to-rhnsd-5.0.13-9-el7.patch

630c23
diff --git a/rhnsd.c b/rhnsd.c
630c23
index 896b433..6190c0a 100644
630c23
--- a/rhnsd.c
630c23
+++ b/rhnsd.c
630c23
@@ -49,9 +49,6 @@ static int write_pid (const char *file);
630c23
 static void print_version (FILE *stream, struct argp_state *state);
630c23
 void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
630c23
 
630c23
-/* Current rhn_check pid */
630c23
-pid_t rhn_check_pid;
630c23
-
630c23
 /* Definitions of arguments for argp functions.  */
630c23
 static const struct argp_option options[] =
630c23
 {
630c23
@@ -148,34 +145,16 @@ int main (int argc, char **argv)
630c23
     if (!foreground) {
630c23
 	int i;
630c23
 
630c23
-	    pid_t pid;
630c23
-        pid = fork();
630c23
-        if (pid < 0)
630c23
-	        exit (EXIT_FAILURE);
630c23
-
630c23
-        if (pid > 0)
630c23
-            exit(EXIT_SUCCESS);
630c23
-
630c23
+	if (fork ())
630c23
+	    exit (0);
630c23
 
630c23
 	for (i = 0; i < getdtablesize(); i++)
630c23
 	    close (i);
630c23
 
630c23
-	/* read from /dev/null */
630c23
-	int devnull = open("/dev/null", O_RDONLY);
630c23
-	if ((devnull >= 0) && (devnull != STDIN_FILENO)) {
630c23
-	    dup2(devnull, STDIN_FILENO);
630c23
-	    close(devnull);
630c23
-	}
630c23
-
630c23
-        pid = fork();
630c23
-        if (pid < 0)
630c23
-            exit (EXIT_FAILURE);
630c23
-
630c23
-        if (pid > 0)
630c23
-            exit(EXIT_SUCCESS);
630c23
+	if (fork ())
630c23
+	    exit (0);
630c23
 
630c23
-        if (setsid() < 0)
630c23
-            exit(EXIT_FAILURE);
630c23
+	setsid();
630c23
 
630c23
 	chdir ("/");
630c23
 
630c23
@@ -273,13 +252,11 @@ Written by %s.\n\
630c23
 static void termination_handler (int signum)
630c23
 {
630c23
     syslog(LOG_NOTICE, "Exiting");
630c23
-    /* Send SIGTERM to current running rhn_check
630c23
-     * and wait for it to exit. */
630c23
-    kill(rhn_check_pid, SIGTERM);
630c23
-    wait(NULL);
630c23
+
630c23
     /* Clean up pid file.  */
630c23
     unlink (_PATH_RHNDPID);
630c23
-    exit(EXIT_SUCCESS);
630c23
+
630c23
+    exit (EXIT_SUCCESS);
630c23
 }
630c23
 
630c23
 /* Returns 1 if the process in pid file FILE is running, 0 if not.  */
630c23
@@ -417,11 +394,10 @@ static int rhn_do_action(void)
630c23
 	openlog("rhnsd", LOG_CONS | LOG_ODELAY | LOG_PID, LOG_DAEMON);
630c23
 
630c23
 	/* syslog for safekeeping */
630c23
-	syslog(LOG_NOTICE, "running program %s with PID %d", RHN_CHECK, getpid());
630c23
+	syslog(LOG_DEBUG, "running program %s", RHN_CHECK);
630c23
 
630c23
         unset_signal_handlers ();
630c23
         /* exec binary helper */
630c23
-        rhn_check_pid = getpid();
630c23
         args[0] = RHN_CHECK;
630c23
         execv(RHN_CHECK, args);
630c23
 
630c23
@@ -431,7 +407,6 @@ static int rhn_do_action(void)
630c23
                strerror(errno));
630c23
         exit(errno);
630c23
     } else if (child > 0) {
630c23
-        set_signal_handlers();
630c23
 	int ret = 1;
630c23
 	char *buf, buffer[10];
630c23
 	int bufsize = 0;
630c23
diff --git a/rhnsd.init b/rhnsd.init
630c23
index dead8bf..ee3e811 100644
630c23
--- a/rhnsd.init
630c23
+++ b/rhnsd.init
630c23
@@ -53,7 +53,7 @@ start() {
630c23
 
630c23
 stop() {
630c23
     echo -n $"Stopping Spacewalk Daemon: "
630c23
-    killproc rhnsd -TERM
630c23
+    killproc rhnsd
630c23
     RETVAL=$?
630c23
     echo
630c23
     if [ $RETVAL -eq 0 ]; then
630c23
diff --git a/rhnsd.spec b/rhnsd.spec
630c23
index 42ad138..2a192f6 100644
630c23
--- a/rhnsd.spec
630c23
+++ b/rhnsd.spec
630c23
@@ -5,7 +5,7 @@ Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.
630c23
 URL:     https://fedorahosted.org/spacewalk
630c23
 Name: rhnsd
630c23
 Version: 5.0.13
630c23
-Release: 8%{?dist}
630c23
+Release: 9%{?dist}
630c23
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
630c23
 
630c23
 BuildRequires: gettext
630c23
@@ -138,6 +138,12 @@ rm -fr $RPM_BUILD_ROOT
630c23
 %doc LICENSE
630c23
 
630c23
 %changelog
630c23
+* Mon Oct 09 2017 Tomas Kasparek <tkasparek@redhat.com> 5.0.13-9
630c23
+- Related: #1499793 - revert previous reboot loop changes
630c23
+  (tkasparek@redhat.com)
630c23
+- Resolves: #1499793 - Revert "1260527 RHEL7 rhnsd reload doesn't work"
630c23
+  (tkasparek@redhat.com)
630c23
+
630c23
 * Wed Sep 20 2017 Tomas Kasparek <tkasparek@redhat.com> 5.0.13-8
630c23
 - Resolves: #1480306 - change permissions for rhnsd.pid (grinrag@gmail.com)
630c23
 - Resolves: #1489989 - umask(0) does not reset to default umask