From cadd0d51fb2fe861291f54cd8fc896c86bf76883 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 19 Sep 2017 23:12:15 +1000 Subject: [PATCH] ctdb-common: Remove unused function ctdb_parse_connections() Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/common/system.h | 3 --- ctdb/common/system_util.c | 57 ----------------------------------------------- 2 files changed, 60 deletions(-) diff --git a/ctdb/common/system.h b/ctdb/common/system.h index 2875760806a..1f479cef106 100644 --- a/ctdb/common/system.h +++ b/ctdb/common/system.h @@ -62,7 +62,4 @@ void mkdir_p_or_die(const char *dir, int mode); void ctdb_wait_for_process_to_exit(pid_t pid); -int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx, - int *num_conn, struct ctdb_connection **out); - #endif /* __CTDB_SYSTEM_H__ */ diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c index 96ea71dafaf..ee48da74486 100644 --- a/ctdb/common/system_util.c +++ b/ctdb/common/system_util.c @@ -378,60 +378,3 @@ void ctdb_wait_for_process_to_exit(pid_t pid) sleep(5); } } - -int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx, - int *num_conn, struct ctdb_connection **out) -{ - struct ctdb_connection *conn = NULL; - char line[128], src[128], dst[128]; /* long enough for IPv6 */ - int line_num, ret; - int num = 0, max = 0; - - line_num = 0; - while (! feof(fp)) { - if (fgets(line, sizeof(line), fp) == NULL) { - break; - } - line_num += 1; - - /* Skip empty lines */ - if (line[0] == '\n') { - continue; - } - - ret = sscanf(line, "%s %s\n", src, dst); - if (ret != 2) { - DEBUG(DEBUG_ERR, ("Bad line [%d]: %s\n", - line_num, line)); - talloc_free(conn); - return EINVAL; - } - - if (num >= max) { - max += 1024; - conn = talloc_realloc(mem_ctx, conn, - struct ctdb_connection, max); - if (conn == NULL) { - return ENOMEM; - } - } - - if (! parse_ip_port(src, &conn[num].src)) { - DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", src)); - talloc_free(conn); - return EINVAL; - } - - if (! parse_ip_port(dst, &conn[num].dst)) { - DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", dst)); - talloc_free(conn); - return EINVAL; - } - - num += 1; - } - - *num_conn = num; - *out = conn; - return 0; -} -- 2.11.4.GIT