help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ReturnsZero(): command does not return zero. Is classcreatedwith val


From: Mark . Burgess
Subject: Re: ReturnsZero(): command does not return zero. Is classcreatedwith value of false?
Date: Thu, 29 Apr 2004 23:37:13 +0200 (MEST)

ok thanks - I have applied this and it should appear in the snapshot shortly.

M

On 29 Apr, Villalovos, John L wrote:
> This patch maybe a little bit more correct.
> 
> John
> 
> diff -Naur cfengine-2.1.5.orig/src/misc.c cfengine-2.1.5/src/misc.c
> --- cfengine-2.1.5.orig/src/misc.c    2004-04-12 03:48:18.000000000
> -0700
> +++ cfengine-2.1.5/src/misc.c 2004-04-29 10:05:38.000000000 -0700
> @@ -626,35 +626,36 @@
>     }
>  else                                    /* parent */
>     {
> -   if (wait(&status) != pid)
> +   pid_t wait_result;
> +   while( (wait_result = wait(&status)) != pid)
>        {
> -      snprintf(OUTPUT,bufsize,"Wait for child failed\n");
> -      CfLog(cfinform,OUTPUT,"wait");
> -      return false;
> +      if (wait_result <= 0)
> +      {
> +      snprintf(OUTPUT,bufsize,"Wait for child failed\n");
> +      CfLog(cfinform,OUTPUT,"wait");
> +      return false;
> +      }
>        }
> -   else
> +   if (WIFSIGNALED(status))
>        {
> -      if (WIFSIGNALED(status))
> -         {
> -         Debug("Script %s returned: %d\n",comm,WTERMSIG(status));
> -         return false;
> -         }
> +      Debug("Script %s returned: %d\n",comm,WTERMSIG(status));
> +      return false;
> +      }
>  
> -      if (! WIFEXITED(status))
> -         {
> -         return false;
> -         }
> +   if (! WIFEXITED(status))
> +      {
> +      return false;
> +      }
>  
> -      if (WEXITSTATUS(status) == 0)
> -         {
> -  Debug("Shell command returned 0\n");
> -         return true;
> -         }
> -      else
> -         {
> -  Debug("Shell command was non-zero\n");
> -         return false;
> -         }
> +   if (WEXITSTATUS(status) == 0)
> +      {
> +Debug("Shell command returned 0\n");
> +      return true;
> +      }
> +   else
> +      {
> +Debug("Shell command was non-zero\n");
> +      return false;
>        }
>     }
>  
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]