From: Ronnie Sahlberg Date: Wed, 8 Aug 2007 00:19:42 +0000 (+1000) Subject: change fprintf(stderr to DEBUG(0, now that client DEBUGs are redirected X-Git-Tag: tevent-0.9.20~348^2~2442^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26d3cd38a92dc29f25943231ebf7315062298319;p=thirdparty%2Fsamba.git change fprintf(stderr to DEBUG(0, now that client DEBUGs are redirected to stderr (This used to be ctdb commit 14078130d295014a751f3e0039bc8eaf427440f9) --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index c864fdefdb5..4529f610e5d 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -48,7 +48,7 @@ static int control_process_exists(struct ctdb_context *ctdb, int argc, const cha } if (sscanf(argv[0], "%u:%u", &vnn, &pid) != 2) { - fprintf(stderr, "Badly formed vnn:pid\n"); + DEBUG(0, ("Badly formed vnn:pid\n")); return -1; } @@ -151,7 +151,7 @@ static int control_statistics_all(struct ctdb_context *ctdb) offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t); ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1); if (ret != 0) { - fprintf(stderr, "Unable to get statistics from node %u\n", nodes[i]); + DEBUG(0, ("Unable to get statistics from node %u\n", nodes[i])); return ret; } for (j=0;jgeneration); @@ -290,14 +290,14 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv ret = ctdb_ctrl_getrecmode(ctdb, TIMELIMIT(), options.vnn, &recmode); if (ret != 0) { - fprintf(stderr, "Unable to get recmode from node %u\n", options.vnn); + DEBUG(0, ("Unable to get recmode from node %u\n", options.vnn)); return ret; } printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode); ret = ctdb_ctrl_getrecmaster(ctdb, TIMELIMIT(), options.vnn, &recmaster); if (ret != 0) { - fprintf(stderr, "Unable to get recmaster from node %u\n", options.vnn); + DEBUG(0, ("Unable to get recmaster from node %u\n", options.vnn)); return ret; } printf("Recovery master:%d\n",recmaster); @@ -322,7 +322,7 @@ static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char * ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.vnn, ctdb, vnn, &list); if (ret == -1) { - fprintf(stderr, "Unable to list tickles\n"); + DEBUG(0, ("Unable to list tickles\n")); return -1; } @@ -351,18 +351,18 @@ static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv) } if (!parse_ip_port(argv[0], &killtcp.src)) { - fprintf(stderr, "Bad IP:port '%s'\n", argv[0]); + DEBUG(0, ("Bad IP:port '%s'\n", argv[0])); return -1; } if (!parse_ip_port(argv[1], &killtcp.dst)) { - fprintf(stderr, "Bad IP:port '%s'\n", argv[1]); + DEBUG(0, ("Bad IP:port '%s'\n", argv[1])); return -1; } ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.vnn, &killtcp); if (ret != 0) { - fprintf(stderr, "Unable to killtcp from node %u\n", options.vnn); + DEBUG(0, ("Unable to killtcp from node %u\n", options.vnn)); return ret; } @@ -382,18 +382,18 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv) } if (!parse_ip_port(argv[0], &src)) { - fprintf(stderr, "Bad IP:port '%s'\n", argv[0]); + DEBUG(0, ("Bad IP:port '%s'\n", argv[0])); return -1; } if (!parse_ip_port(argv[1], &dst)) { - fprintf(stderr, "Bad IP:port '%s'\n", argv[1]); + DEBUG(0, ("Bad IP:port '%s'\n", argv[1])); return -1; } s = ctdb_sys_open_sending_socket(); if (s == -1) { - fprintf(stderr, "Failed to open socket for sending tickle\n"); + DEBUG(0, ("Failed to open socket for sending tickle\n")); return 0; } @@ -402,7 +402,7 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv) if (ret==0) { return 0; } - fprintf(stderr, "Error while sending tickle ack\n"); + DEBUG(0, ("Error while sending tickle ack\n")); return -1; } @@ -423,7 +423,7 @@ static int control_ip(struct ctdb_context *ctdb, int argc, const char **argv) 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); + DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn)); return ret; } @@ -464,7 +464,7 @@ static int control_publicip(struct ctdb_context *ctdb, int argc, const char **ar 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); + DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn)); return ret; } @@ -483,7 +483,7 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.vnn, &pid); if (ret != 0) { - fprintf(stderr, "Unable to get daemon pid from node %u\n", options.vnn); + DEBUG(0, ("Unable to get daemon pid from node %u\n", options.vnn)); return ret; } printf("Pid:%d\n", pid); @@ -500,7 +500,7 @@ static int control_disable(struct ctdb_context *ctdb, int argc, const char **arg ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0); if (ret != 0) { - fprintf(stderr, "Unable to disable node %u\n", options.vnn); + DEBUG(0, ("Unable to disable node %u\n", options.vnn)); return ret; } @@ -516,7 +516,7 @@ static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED); if (ret != 0) { - fprintf(stderr, "Unable to enable node %u\n", options.vnn); + DEBUG(0, ("Unable to enable node %u\n", options.vnn)); return ret; } @@ -599,7 +599,7 @@ static int control_shutdown(struct ctdb_context *ctdb, int argc, const char **ar ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.vnn); if (ret != 0) { - fprintf(stderr, "Unable to shutdown node %u\n", options.vnn); + DEBUG(0, ("Unable to shutdown node %u\n", options.vnn)); return ret; } @@ -615,13 +615,13 @@ static int control_recover(struct ctdb_context *ctdb, int argc, const char **arg ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn); if (ret != 0) { - fprintf(stderr, "Unable to freeze node\n"); + DEBUG(0, ("Unable to freeze node\n")); return ret; } ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.vnn, CTDB_RECOVERY_ACTIVE); if (ret != 0) { - fprintf(stderr, "Unable to set recovery mode\n"); + DEBUG(0, ("Unable to set recovery mode\n")); return ret; } @@ -639,7 +639,7 @@ static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char ** ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.vnn, &monmode); if (ret != 0) { - fprintf(stderr, "Unable to get monmode from node %u\n", options.vnn); + DEBUG(0, ("Unable to get monmode from node %u\n", options.vnn)); return ret; } printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode); @@ -663,7 +663,7 @@ static int control_setmonmode(struct ctdb_context *ctdb, int argc, const char ** ret = ctdb_ctrl_setmonmode(ctdb, TIMELIMIT(), options.vnn, monmode); if (ret != 0) { - fprintf(stderr, "Unable to set monmode on node %u\n", options.vnn); + DEBUG(0, ("Unable to set monmode on node %u\n", options.vnn)); return ret; } @@ -694,7 +694,7 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv) /* traverse and dump the cluster tdb */ ret = ctdb_dump_db(ctdb_db, stdout); if (ret == -1) { - fprintf(stderr, "Unable to dump database\n"); + DEBUG(0, ("Unable to dump database\n")); return -1; } talloc_free(ctdb_db); @@ -714,7 +714,7 @@ static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **ar ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &dbmap); if (ret != 0) { - fprintf(stderr, "Unable to get dbids from node %u\n", options.vnn); + DEBUG(0, ("Unable to get dbids from node %u\n", options.vnn)); return ret; } @@ -765,7 +765,7 @@ static int control_getvar(struct ctdb_context *ctdb, int argc, const char **argv name = argv[0]; ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.vnn, name, &value); if (ret == -1) { - fprintf(stderr, "Unable to get tunable variable '%s'\n", name); + DEBUG(0, ("Unable to get tunable variable '%s'\n", name)); return -1; } @@ -791,7 +791,7 @@ static int control_setvar(struct ctdb_context *ctdb, int argc, const char **argv ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.vnn, name, value); if (ret == -1) { - fprintf(stderr, "Unable to set tunable variable '%s'\n", name); + DEBUG(0, ("Unable to set tunable variable '%s'\n", name)); return -1; } return 0; @@ -808,7 +808,7 @@ static int control_listvars(struct ctdb_context *ctdb, int argc, const char **ar ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.vnn, ctdb, &list, &count); if (ret == -1) { - fprintf(stderr, "Unable to list tunable variables\n"); + DEBUG(0, ("Unable to list tunable variables\n")); return -1; } @@ -831,8 +831,8 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar ret = ctdb_ctrl_get_debuglevel(ctdb, options.vnn, &level); if (ret != 0) { - fprintf(stderr, "Unable to get debuglevel response from node %u\n", - options.vnn); + DEBUG(0, ("Unable to get debuglevel response from node %u\n", + options.vnn)); } else { printf("Node %u is at debug level %u\n", options.vnn, level); } @@ -856,7 +856,7 @@ static int control_setdebug(struct ctdb_context *ctdb, int argc, const char **ar ret = ctdb_ctrl_set_debuglevel(ctdb, options.vnn, level); if (ret != 0) { - fprintf(stderr, "Unable to set debug level on node %u\n", options.vnn); + DEBUG(0, ("Unable to set debug level on node %u\n", options.vnn)); } return 0; } @@ -871,7 +871,7 @@ static int control_freeze(struct ctdb_context *ctdb, int argc, const char **argv ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn); if (ret != 0) { - fprintf(stderr, "Unable to freeze node %u\n", options.vnn); + DEBUG(0, ("Unable to freeze node %u\n", options.vnn)); } return 0; } @@ -885,7 +885,7 @@ static int control_thaw(struct ctdb_context *ctdb, int argc, const char **argv) ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.vnn); if (ret != 0) { - fprintf(stderr, "Unable to thaw node %u\n", options.vnn); + DEBUG(0, ("Unable to thaw node %u\n", options.vnn)); } return 0; } @@ -1017,8 +1017,8 @@ int main(int argc, const char *argv[]) while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { default: - fprintf(stderr, "Invalid option %s: %s\n", - poptBadOption(pc, 0), poptStrerror(opt)); + DEBUG(0, ("Invalid option %s: %s\n", + poptBadOption(pc, 0), poptStrerror(opt))); exit(1); } } @@ -1050,7 +1050,7 @@ int main(int argc, const char *argv[]) /* initialise ctdb */ ctdb = ctdb_cmdline_client(ev); if (ctdb == NULL) { - fprintf(stderr, "Failed to init ctdb\n"); + DEBUG(0, ("Failed to init ctdb\n")); exit(1); } @@ -1089,7 +1089,7 @@ int main(int argc, const char *argv[]) } if (i == ARRAY_SIZE(ctdb_commands)) { - fprintf(stderr, "Unknown control '%s'\n", control); + DEBUG(0, ("Unknown control '%s'\n", control)); exit(1); }