summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-08-21 18:36:33 +0000
committerJeremy Allison <jra@samba.org>2014-08-23 00:24:18 +0200
commit46e912210d62baf895c3e526be5109724475b536 (patch)
treef0f7dd4acf3fecc7f269618f802220143dd20227 /lib
parent1c4284c7395f23cefa61a407db74cf5067aee2aa (diff)
downloadsamba-46e912210d62baf895c3e526be5109724475b536.tar.gz
lib: Introduce server_id_same_process()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/util/samba_util.h2
-rw-r--r--lib/util/server_id.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 233b5fd8cb0..f1f4c2df839 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -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,
diff --git a/lib/util/server_id.c b/lib/util/server_id.c
index e0a05a73b83..7d3de2f9f55 100644
--- a/lib/util/server_id.c
+++ b/lib/util/server_id.c
@@ -20,9 +20,15 @@
#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;
}