[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shellcommands don't do elsedefine
From: |
Martin Andrews |
Subject: |
shellcommands don't do elsedefine |
Date: |
Wed, 19 Feb 2003 04:16:57 -0000 |
I am using cfengine 2.0.5 and I noticed the elsedefine class was never set
on shellcommands. It appears that it was only processed if the OS did not
have waitpid(). Below is a patch to fix. Still not sure about this section
of code though. It does a loop for waitpid() but not for plain wait() - I
would think it would be the other way around (because wait() may get a
return from another process).
Martin
address@hidden
--- cfengine-2.0.5/src/popen_def.c.orig Tue Feb 18 21:39:45 2003
+++ cfengine-2.0.5/src/popen_def.c Tue Feb 18 21:46:07 2003
@@ -86,47 +86,33 @@
return -1;
}
}
-
-if (status == 0)
- {
- AddMultipleClasses(defines);
- }
-else
- {
- Debug("Child returned status %d\n",status);
- }
-
-return status;
-
#else
if (wait(&status) != pid)
{
return -1;
}
- else
- {
- if (WIFSIGNALED(status))
- {
- return -1;
- }
-
- if (! WIFEXITED(status))
- {
- return -1;
- }
+#endif
+
+if (WIFSIGNALED(status))
+ {
+ return -1;
+ }
- if (WEXITSTATUS(status) == 0)
- {
- AddMultipleClasses(defines);
- }
- else
- {
- AddMultipleClasses(elsedef);
- }
+if (! WIFEXITED(status))
+ {
+ return -1;
+ }
- return (WEXITSTATUS(status));
- }
-#endif
+if (WEXITSTATUS(status) == 0)
+ {
+ AddMultipleClasses(defines);
+ }
+else
+ {
+ AddMultipleClasses(elsedef);
+ }
+
+return (WEXITSTATUS(status));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- shellcommands don't do elsedefine,
Martin Andrews <=