Add assertions that kill() is never accidentally passed a non-positive
[kai/samba.git] / source3 / lib / messages.c
index 642caafac416ea0c2b9dcbb138a88f57f5c3c147..b745cbaf8bde3880ba0b0d1a181af22ae40c7b80 100644 (file)
@@ -144,6 +144,9 @@ static TDB_DATA message_key_pid(pid_t pid)
 
 static BOOL message_notify(pid_t pid)
 {
+       /* Doing kill with a non-positive pid causes messages to be
+        * sent to places we don't want. */
+       SMB_ASSERT(pid > 0);
        if (kill(pid, SIGUSR1) == -1) {
                if (errno == ESRCH) {
                        DEBUG(2,("pid %d doesn't exist - deleting messages record\n", (int)pid));
@@ -174,6 +177,10 @@ BOOL message_send_pid(pid_t pid, int msg_type, const void *buf, size_t len,
        rec.src = sys_getpid();
        rec.len = len;
 
+       /* Doing kill with a non-positive pid causes messages to be
+        * sent to places we don't want. */
+       SMB_ASSERT(pid > 0);
+
        kbuf = message_key_pid(pid);
 
        /* lock the record for the destination */