summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-06-03 13:04:56 +0000
committerJeremy Allison <jra@samba.org>2014-06-17 07:00:14 +0200
commitf0e1a8e1e2f67cc18099c3c56b99777bc7ef7b7f (patch)
tree371aa2b78df06958efa1e31815bf2caf9ab3ea5e
parent7a3bda54b01991ca45ba2157636f4e01dc425bcb (diff)
downloadsamba-f0e1a8e1e2f67cc18099c3c56b99777bc7ef7b7f.tar.gz
samba-f0e1a8e1e2f67cc18099c3c56b99777bc7ef7b7f.tar.xz
samba-f0e1a8e1e2f67cc18099c3c56b99777bc7ef7b7f.zip
lib: Use server_id_str_buf in server_id_str
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/util/server_id.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/lib/util/server_id.c b/lib/util/server_id.c
index 4a844330ef3..e0a05a73b83 100644
--- a/lib/util/server_id.c
+++ b/lib/util/server_id.c
@@ -65,29 +65,19 @@ char *server_id_str_buf(struct server_id id, struct server_id_buf *dst)
char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id)
{
- if (server_id_is_disconnected(id)) {
- return talloc_strdup(mem_ctx, "disconnected");
- } else if (id->vnn == NONCLUSTER_VNN && id->task_id == 0) {
- return talloc_asprintf(mem_ctx,
- "%llu",
- (unsigned long long)id->pid);
- } else if (id->vnn == NONCLUSTER_VNN) {
- return talloc_asprintf(mem_ctx,
- "%llu.%u",
- (unsigned long long)id->pid,
- (unsigned)id->task_id);
- } else if (id->task_id == 0) {
- return talloc_asprintf(mem_ctx,
- "%u:%llu",
- (unsigned)id->vnn,
- (unsigned long long)id->pid);
- } else {
- return talloc_asprintf(mem_ctx,
- "%u:%llu.%u",
- (unsigned)id->vnn,
- (unsigned long long)id->pid,
- (unsigned)id->task_id);
+ struct server_id_buf tmp;
+ char *result;
+
+ result = talloc_strdup(mem_ctx, server_id_str_buf(*id, &tmp));
+ if (result == NULL) {
+ return NULL;
}
+
+ /*
+ * beautify the talloc_report output
+ */
+ talloc_set_name_const(result, result);
+ return result;
}
struct server_id server_id_from_string(uint32_t local_vnn,