rpms/xscreensaver/devel xscreensaver-4.22-signal-handler-fun.patch, NONE, 1.1 xscreensaver.spec, 1.52, 1.53

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Aug 10 18:25:49 UTC 2005


Author: rstrode

Update of /cvs/dist/rpms/xscreensaver/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv6358

Modified Files:
	xscreensaver.spec 
Added Files:
	xscreensaver-4.22-signal-handler-fun.patch 
Log Message:
- Don't call printf in signal handler (might fix 126428)


xscreensaver-4.22-signal-handler-fun.patch:
 subprocs.c |  159 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 139 insertions(+), 20 deletions(-)

--- NEW FILE xscreensaver-4.22-signal-handler-fun.patch ---
--- xscreensaver-4.22/driver/subprocs.c.signal-handler-fun	2005-06-04 15:50:23.000000000 -0400
+++ xscreensaver-4.22/driver/subprocs.c	2005-08-10 14:22:27.000000000 -0400
@@ -412,8 +412,15 @@
   saver_info *si = global_si_kludge;	/* I hate C so much... */
 
   if (si->prefs.debug_p)
-    fprintf(stderr, "%s: got SIGCHLD%s\n", blurb(),
-	    (block_sigchld_handler ? " (blocked)" : ""));
+    {
+      write (STDERR_FILENO, blurb(), strlen (blurb()));
+      write (STDERR_FILENO, ": got SIGCHLD", strlen (": got SIGCHLD"));
+
+      if (block_sigchld_handler)
+        write (STDERR_FILENO, " (blocked)\n", strlen (" (blocked)\n"));
+      else
+        write (STDERR_FILENO, "\n", strlen ("\n"));
+    }
 
   if (block_sigchld_handler < 0)
     abort();
@@ -430,6 +437,43 @@
 
 
 #ifndef VMS
+
+static const char *
+no_malloc_number_to_string (long num)
+{
+  static char string[128] = "";
+  int num_digits;
+  Bool negative_p = False;
+
+  num_digits = 0;
+
+  if (num == 0)
+    return "0";
+
+  if (num < 0)
+    {
+      negative_p = True;
+      num = -num;
+    }
+
+  while ((num > 0) && (num_digits < sizeof(string - 1)))
+    {
+      int digit;
+      digit = (int) num % 10;
+      num_digits++;
+      string[sizeof(string) - 1 - num_digits] = digit + '0';
+      num /= 10;
+    }
+
+  if (negative_p)
+    {
+      num_digits++;
+      string[sizeof(string) - 1 - num_digits] = '-';
+    }
+
+  return string + sizeof(string) - 1 - num_digits;
+}
+
 static void
 await_dying_children (saver_info *si)
 {
@@ -443,12 +487,27 @@
 
       if (si->prefs.debug_p)
 	{
+          const char *string;
+
 	  if (kid < 0 && errno)
-	    fprintf (stderr, "%s: waitpid(-1) ==> %ld (%d)\n", blurb(),
-		     (long) kid, errno);
-	  else
-	    fprintf (stderr, "%s: waitpid(-1) ==> %ld\n", blurb(),
-		     (long) kid);
+            {
+              write (STDERR_FILENO, blurb(), strlen (blurb()));
+              write (STDERR_FILENO, ": waitpid(-1) ==> ", strlen (": waitpid(-1) ==> "));
+              string = no_malloc_number_to_string ((long) kid);
+              write (STDERR_FILENO, string, strlen (string));
+              write (STDERR_FILENO, " (", strlen (" ("));
+              string = no_malloc_number_to_string ((long) errno);
+              write (STDERR_FILENO, string, strlen (string));
+              write (STDERR_FILENO, ")\n", strlen (")\n"));
+            }
+          else
+            {
+              write (STDERR_FILENO, blurb(), strlen (blurb()));
+              write (STDERR_FILENO, ": waitpid(-1) ==> ", strlen (": waitpid(-1) ==> "));
+              string = no_malloc_number_to_string ((long) kid);
+              write (STDERR_FILENO, string, strlen (string));
+              write (STDERR_FILENO, "\n", strlen ("\n"));
+            }
 	}
 
       /* 0 means no more children to reap.
@@ -471,6 +530,7 @@
   struct screenhack_job *job = find_job (kid);
   const char *name = job ? job->name : "<unknown>";
   int screen_no = job ? job->screen : 0;
+  const char *string;
 
   if (WIFEXITED (wait_status))
     {
@@ -488,12 +548,36 @@
       if (!job ||
 	  (exit_status != 0 &&
 	   (p->verbose_p || job->status != job_killed)))
-	fprintf (stderr,
-		 "%s: %d: child pid %lu (%s) exited abnormally (code %d).\n",
-		 blurb(), screen_no, (unsigned long) kid, name, exit_status);
+        {
+          write (STDERR_FILENO, blurb(), strlen (blurb()));
+          write (STDERR_FILENO, ": ", strlen (": "));
+          string = no_malloc_number_to_string ((long) screen_no);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ": child pid ", strlen (": child pid "));
+          string = no_malloc_number_to_string ((long) kid);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, " (", strlen (" ("));
+          write (STDERR_FILENO, name, strlen (name));
+          write (STDERR_FILENO, ") exited abnormally (code ", 
+                 strlen (") exited abnormally (code " ));
+          string = no_malloc_number_to_string ((long) exit_status);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ").\n", strlen (").\n")); 
+        }
       else if (p->verbose_p)
-	fprintf (stderr, "%s: %d: child pid %lu (%s) exited normally.\n",
-		 blurb(), screen_no, (unsigned long) kid, name);
+        {
+          write (STDERR_FILENO, blurb(), strlen (blurb()));
+          write (STDERR_FILENO, ": ", strlen (": "));
+          string = no_malloc_number_to_string ((long) screen_no);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ": child pid ", strlen (": child pid "));
+          string = no_malloc_number_to_string ((long) kid);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, " (", strlen (" ("));
+          write (STDERR_FILENO, name, strlen (name));
+          write (STDERR_FILENO, ") exited normally.\n", 
+                 strlen (") exited normally.\n"));
+        }
 
       if (job)
 	job->status = job_dead;
@@ -504,9 +588,22 @@
 	  !job ||
 	  job->status != job_killed ||
 	  WTERMSIG (wait_status) != SIGTERM)
-	fprintf (stderr, "%s: %d: child pid %lu (%s) terminated with %s.\n",
-		 blurb(), screen_no, (unsigned long) kid, name,
-		 signal_name (WTERMSIG(wait_status)));
+        {
+          write (STDERR_FILENO, blurb(), strlen (blurb()));
+          write (STDERR_FILENO, ": ", strlen (": "));
+          string = no_malloc_number_to_string ((long) screen_no);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ": child pid ", strlen (": child pid "));
+          string = no_malloc_number_to_string ((long) kid);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, " (", strlen (" ("));
+          write (STDERR_FILENO, name, strlen (name));
+          write (STDERR_FILENO, ") terminated with signal ", 
+                 strlen (") terminated with signal "));
+          string = no_malloc_number_to_string (WTERMSIG(wait_status));
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ".\n", strlen (".\n"));
+        }
 
       if (job)
 	job->status = job_dead;
@@ -514,17 +611,39 @@
   else if (WIFSTOPPED (wait_status))
     {
       if (p->verbose_p)
-	fprintf (stderr, "%s: child pid %lu (%s) stopped with %s.\n",
-		 blurb(), (unsigned long) kid, name,
-		 signal_name (WSTOPSIG (wait_status)));
+        {
+          write (STDERR_FILENO, blurb(), strlen (blurb()));
+          write (STDERR_FILENO, ": ", strlen (": "));
+          string = no_malloc_number_to_string ((long) screen_no);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ": child pid ", strlen (": child pid "));
+          string = no_malloc_number_to_string ((long) kid);
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, " (", strlen (" ("));
+          write (STDERR_FILENO, name, strlen (name));
+          write (STDERR_FILENO, ") stopped with signal ", 
+                 strlen (")stopped with signal "));
+          string = no_malloc_number_to_string (WSTOPSIG(wait_status));
+          write (STDERR_FILENO, string, strlen (string));
+          write (STDERR_FILENO, ".\n", strlen (".\n"));
+        }
 
       if (job)
 	job->status = job_stopped;
     }
   else
     {
-      fprintf (stderr, "%s: child pid %lu (%s) died in a mysterious way!",
-	       blurb(), (unsigned long) kid, name);
+      write (STDERR_FILENO, blurb(), strlen (blurb()));
+      write (STDERR_FILENO, ": ", strlen (": "));
+      string = no_malloc_number_to_string ((long) screen_no);
+      write (STDERR_FILENO, string, strlen (string));
+      write (STDERR_FILENO, ": child pid ", strlen (": child pid "));
+      string = no_malloc_number_to_string ((long) kid);
+      write (STDERR_FILENO, string, strlen (string));
+      write (STDERR_FILENO, " (", strlen (" ("));
+      write (STDERR_FILENO, name, strlen (name));
+      write (STDERR_FILENO, ") died in a mysterious way!",
+             strlen (") died in a mysterious way!"));
       if (job)
 	job->status = job_dead;
     }


Index: xscreensaver.spec
===================================================================
RCS file: /cvs/dist/rpms/xscreensaver/devel/xscreensaver.spec,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- xscreensaver.spec	3 Aug 2005 21:15:59 -0000	1.52
+++ xscreensaver.spec	10 Aug 2005 18:25:45 -0000	1.53
@@ -4,7 +4,7 @@
 Summary:	X screen saver and locker
 Name:		%{name}
 Version:	%{version}
-Release:	5
+Release:	6
 Epoch:		1
 License:	BSD
 Group:		Amusements/Graphics
@@ -16,6 +16,7 @@
 Patch2:         xscreensaver-4.21-dont-ping-if-not-root.patch
 Patch3:		xscreensaver-4.22-make-hack-paths-absolute.patch
 Patch4:         xscreensaver-4.21-use-hack-basename.patch
+Patch5:         xscreensaver-4.22-signal-handler-fun.patch
 Buildroot:	%{_tmppath}/%{name}-root
 
 # find_lang
@@ -75,6 +76,7 @@
 %patch2 -p1 -b .dont-ping-if-not-root
 %patch3 -p1 -b .make-hack-paths-absolute
 %patch4 -p1 -b .use-hack-basename
+%patch5 -p1 -b .signal-handler-fun
 
 if [ -x %{_datadir}/libtool/config.guess ]; then
   # use system-wide copy
@@ -203,7 +205,10 @@
 %defattr(-,root,root)
 
 %changelog
-* Wed Aug  3 2005 Ray Strode <rstrode at redhat.com> 1:4.22-1
+* Wed Aug 10 2005 Ray Strode <rstrode at redhat.com> 1:4.22-6
+- Don't call printf in signal handler (might fix 126428)
+
+* Wed Aug  3 2005 Ray Strode <rstrode at redhat.com> 1:4.22-5
 - Update to xscreensaver 4.22.
 
 * Sun Jun 19 2005 Ray Strode <rstrode at redhat.com> 1:4.21-5




More information about the fedora-cvs-commits mailing list