lib: Introduce server_id_same_process()
authorVolker Lendecke <vl@samba.org>
Thu, 21 Aug 2014 18:36:33 +0000 (18:36 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 22 Aug 2014 22:24:18 +0000 (00:24 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/samba_util.h
lib/util/server_id.c

index 233b5fd8cb07c6cd6e8d17144f46abb0333c3e60..f1f4c2df839ec7ff347aa25beb7ea330c9bf978f 100644 (file)
@@ -985,6 +985,8 @@ struct server_id;
 struct server_id_buf { char buf[48]; }; /* probably a bit too large ... */
 char *server_id_str_buf(struct server_id id, struct server_id_buf *dst);
 
+bool server_id_same_process(const struct server_id *p1,
+                           const struct server_id *p2);
 bool server_id_equal(const struct server_id *p1, const struct server_id *p2);
 char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id);
 struct server_id server_id_from_string(uint32_t local_vnn,
index e0a05a73b834182694fc7e6163cee2aba1e900c4..7d3de2f9f551907fe4da516a3a1b4c2d9174d4c4 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/server_id.h"
 
+bool server_id_same_process(const struct server_id *p1,
+                           const struct server_id *p2)
+{
+       return ((p1->pid == p2->pid) && (p1->vnn == p2->vnn));
+}
+
 bool server_id_equal(const struct server_id *p1, const struct server_id *p2)
 {
-       if (p1->pid != p2->pid) {
+       if (!server_id_same_process(p1, p2)) {
                return false;
        }
 
@@ -30,10 +36,6 @@ bool server_id_equal(const struct server_id *p1, const struct server_id *p2)
                return false;
        }
 
-       if (p1->vnn != p2->vnn) {
-               return false;
-       }
-
        if (p1->unique_id != p2->unique_id) {
                return false;
        }