Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision cdea6170559416ef3c4b972a6006f1929ca67446)
+++ cpukit/ChangeLog	(revision 099712815e825e67c72f962cc1e9ee28c81f4335)
@@ -1,2 +1,6 @@
+2009-07-22	Joel Sherrill <joel.sherrill@OARcorp.com>
+
+	* posix/src/killinfo.c: Clean up. Avoid NULL pointer case.
+
 2009-07-22	Joel Sherrill <joel.sherrill@OARcorp.com>
 
Index: cpukit/posix/src/killinfo.c
===================================================================
--- cpukit/posix/src/killinfo.c	(revision cdea6170559416ef3c4b972a6006f1929ca67446)
+++ cpukit/posix/src/killinfo.c	(revision 099712815e825e67c72f962cc1e9ee28c81f4335)
@@ -61,5 +61,4 @@
    *  Only supported for the "calling process" (i.e. this node).
    */
-
   if ( pid != getpid() )
     rtems_set_errno_and_return_minus_one( ESRCH );
@@ -68,5 +67,4 @@
    *  Validate the signal passed.
    */
-
   if ( !sig )
     rtems_set_errno_and_return_minus_one( EINVAL );
@@ -78,8 +76,6 @@
    *  If the signal is being ignored, then we are out of here.
    */
-
-  if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
+  if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN )
     return 0;
-  }
 
   /*
@@ -88,5 +84,4 @@
    *  faults.
    */
-
   if ( (sig == SIGFPE) || (sig == SIGILL) || (sig == SIGSEGV ) )
       return pthread_kill( pthread_self(), sig );
@@ -97,5 +92,4 @@
    *  Build up a siginfo structure
    */
-
   siginfo = &siginfo_struct;
   siginfo->si_signo = sig;
@@ -113,5 +107,4 @@
    *  get it an execute it as soon as the dispatcher executes.
    */
-
   the_thread = _Thread_Executing;
 
@@ -170,5 +163,4 @@
    *    + rtems internal threads do not receive signals.
    */
-
   interested_thread = NULL;
   interested_priority = PRIORITY_MAXIMUM + 1;
@@ -179,5 +171,5 @@
 
     /*
-     *  Thie can occur when no one is interested and ITRON is not configured.
+     *  This can occur when no one is interested and ITRON is not configured.
      */
     if ( !_Objects_Information_table[ the_api ] )
@@ -209,5 +201,4 @@
        *  go on to the next thread.
        */
-
       if ( the_thread->current_priority > interested_priority )
         continue;
@@ -216,5 +207,4 @@
        *  If this thread is not interested, then go on to the next thread.
        */
-
       api = the_thread->API_Extensions[ THREAD_API_POSIX ];
 
@@ -228,9 +218,18 @@
 
       /*
-       *  Now we know the thread under connsideration is interested.
+       *  If we have not seen a thread interested in this signal yet,
+       *  then we have found the first one.
+       */
+      if ( !interested_thread ) {
+        interested_thread   = the_thread;
+        interested_priority = the_thread->current_priority;
+        continue;
+      }
+
+      /*
+       *  Now we know the thread under consideration is interested.
        *  If the thread under consideration is of higher priority, then
        *  it becomes the interested thread.
        */
-
       if ( the_thread->current_priority < interested_priority ) {
         interested_thread   = the_thread;
@@ -244,5 +243,4 @@
        *  to a blocked thread.
        */
-
       if ( _States_Is_ready( interested_thread->current_state ) )
         continue;
@@ -253,5 +251,4 @@
        *  interested thread.
        */
-
       if ( _States_Is_ready( the_thread->current_state ) ) {
         interested_thread   = the_thread;
@@ -264,7 +261,5 @@
        *  If the interested thread is interruptible, then just use it.
        */
-
-      /* XXX need a new states macro */
-      if ( interested_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL )
+      if (_States_Is_interruptible_by_signal(interested_thread->current_state))
         continue;
 
@@ -275,7 +270,5 @@
        *  then it becomes the interested thread.
        */
-
-      /* XXX need a new states macro */
-      if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
+      if ( _States_Is_interruptible_by_signal(the_thread->current_state) ) {
         interested_thread   = the_thread;
         interested_priority = the_thread->current_priority;
@@ -299,5 +292,4 @@
    *    + sigaction() which changes the handler to SIG_IGN.
    */
-
   the_thread = NULL;
   goto post_process_signal;
@@ -308,5 +300,4 @@
    *  evaluate the signals pending.
    */
-
 process_it:
 
@@ -317,5 +308,4 @@
    *  blocked waiting for the signal.
    */
-
   if ( _POSIX_signals_Unblock_thread( the_thread, sig, siginfo ) ) {
     _Thread_Enable_dispatch();
@@ -329,5 +319,4 @@
    *  signal to the process wide information set.
    */
-
   _POSIX_signals_Set_process_signals( mask );
 
@@ -336,7 +325,6 @@
     psiginfo = (POSIX_signals_Siginfo_node *)
                _Chain_Get( &_POSIX_signals_Inactive_siginfo );
-    if ( !psiginfo ) {
+    if ( !psiginfo )
       rtems_set_errno_and_return_minus_one( EAGAIN );
-    }
 
     psiginfo->Info = *siginfo;
