From: Andrew Tridgell Date: Tue, 7 Aug 2007 03:40:13 +0000 (+1000) Subject: merge from ronnie X-Git-Tag: tevent-0.9.20~348^2~2444 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a81a03b9eb3c89474bd46cd872269543627706c;p=thirdparty%2Fsamba.git merge from ronnie (This used to be ctdb commit e06f70f064e39f1a4a394f00b81b6b1d215534d4) --- 8a81a03b9eb3c89474bd46cd872269543627706c diff --cc ctdb/lib/util/debug.c index 1d709248be6,1d709248be6..78d465d52b0 --- a/ctdb/lib/util/debug.c +++ b/ctdb/lib/util/debug.c @@@ -39,7 -39,7 +39,7 @@@ void do_debug(const char *format, ... strftime(tbuf,sizeof(tbuf)-1,"%Y/%m/%d %H:%M:%S", tm); -- printf("%s.%06u [%5u]: %s", tbuf, (unsigned)t.tv_usec, (unsigned)getpid(), s); -- fflush(stdout); ++ fprintf(stderr, "%s.%06u [%5u]: %s", tbuf, (unsigned)t.tv_usec, (unsigned)getpid(), s); ++ fflush(stderr); free(s); } diff --cc ctdb/tools/ctdb.c index 7b44dc62cd2,1663c78afd7..c864fdefdb5 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@@ -217,9 -217,9 +217,12 @@@ static int control_status(struct ctdb_c struct ctdb_vnn_map *vnnmap=NULL; struct ctdb_node_map *nodemap=NULL; uint32_t recmode, recmaster; -- uint32_t myvnn; ++ int myvnn; myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn); ++ if (myvnn == -1) { ++ return -1; ++ } ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.vnn, ctdb, &nodemap); if (ret != 0) { @@@ -411,9 -411,9 +414,12 @@@ static int control_ip(struct ctdb_conte { int i, ret; struct ctdb_all_public_ips *ips; -- uint32_t myvnn; ++ int myvnn; myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn); ++ if (myvnn == -1) { ++ return -1; ++ } ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips); if (ret != 0) { @@@ -442,6 -442,28 +448,31 @@@ return 0; } + /* + display public ip address of this node + */ + static int control_publicip(struct ctdb_context *ctdb, int argc, const char **argv) + { + int ret; + struct ctdb_all_public_ips *ips; - uint32_t myvnn; ++ int myvnn; + + myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn); ++ if (myvnn == -1) { ++ return -1; ++ } + + ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips); + if (ret != 0) { + fprintf(stderr, "Unable to get public ips from node %u\n", options.vnn); + return ret; + } + + printf("%-16s\n", inet_ntoa(ips->ips[myvnn].sin.sin_addr)); + + return 0; + } + /* display pid of a ctdb daemon */ @@@ -1027,7 -1050,7 +1059,12 @@@ int main(int argc, const char *argv[] int j; if (options.vnn == CTDB_CURRENT_NODE) { -- options.vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn); ++ int vnn; ++ vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn); ++ if (vnn == -1) { ++ return -1; ++ } ++ options.vnn = vnn; } if (ctdb_commands[i].auto_all &&