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

Re: Bug#714222: libstoragemgmt: FTBFS on non-Linux: 'WEXITED' undeclared



    CC       lsm_daemon.o
  lsm_daemon.c: In function 'child_cleanup':
  lsm_daemon.c:426:44: error: 'WEXITED' undeclared (first use in this function)
           rc = waitid(P_ALL, 0, &si, WNOHANG|WEXITED);
                                              ^
  lsm_daemon.c:426:44: note: each undeclared identifier is reported only once for each function it appears in

Any help from Hurd / BSD teams will be appreciated. What would be the
replacement for WEXITED ?

Use plain waitpid() instead, it suffices for code needs.
Moreover, I guess that killed child should be logged too.

Petr

--- src/lsm_daemon.c
+++ src/lsm_daemon.c
@@ -420,14 +420,13 @@
     int rc;

     do {
-        siginfo_t si;
-        memset(&si, 0, sizeof(siginfo_t));
+        int status;

-        rc = waitid(P_ALL, 0, &si, WNOHANG|WEXITED);
+        rc = waitpid(-1, &status, WNOHANG);

         if( rc > 0 ) {
-            if( si.si_code == CLD_EXITED && si.si_status != 0 ) {
-                info("Plug-in process %d exited with %d\n", rc, si.si_status);
+            if( !WIFEXITED(status) || (WEXITSTATUS(status) != 0 )) {
+                info("Plug-in process %d exited with %d\n", rc, status);
             }
         } else {
             break;


Reply to: