[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ReturnsZero(): command does not return zero. Is classcreatedwith val
From: |
Villalovos, John L |
Subject: |
RE: ReturnsZero(): command does not return zero. Is classcreatedwith value of false? |
Date: |
Thu, 29 Apr 2004 10:10:16 -0700 |
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;
}
}
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting
Q: What is the most annoying thing on usenet and in e-mail?
wait-debug.diff
Description: wait-debug.diff