One more from waitpid() audit: Correctly interpret waitstatus when a
authorMartin Pool <mbp@samba.org>
Wed, 15 Jan 2003 05:27:33 +0000 (05:27 +0000)
committerMartin Pool <mbp@samba.org>
Wed, 15 Jan 2003 05:27:33 +0000 (05:27 +0000)
child fails.  Possibly this was causing smbmount to exit(0) when it
really should have indicated a failure.

source/client/smbmount.c

index 33adfc4d488f92575d0cd2369751c8b0cf698401..54970f70309cd82cb1c1549b9eb74e042a806cc5 100644 (file)
@@ -78,8 +78,12 @@ static void daemonize(void)
                        }
                        break;
                }
+
                /* If we get here - the child exited with some error status */
-               exit(status);
+               if (WIFSIGNALLED(status))
+                       exit(128 + WTERMSIG(status));
+               else
+                       exit(WEXITSTATUS(status));
        }
 
        signal( SIGTERM, SIG_DFL );