merge from ronnie
authorAndrew Tridgell <tridge@samba.org>
Tue, 7 Aug 2007 03:40:13 +0000 (13:40 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 7 Aug 2007 03:40:13 +0000 (13:40 +1000)
1  2 
lib/util/debug.c
tools/ctdb.c

index 1d709248be6b5925e52778a4423b234b97156aaf,1d709248be6b5925e52778a4423b234b97156aaf..78d465d52b03c88e51574ac664677c8770dfaa63
@@@ -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 tools/ctdb.c
index 7b44dc62cd2bbf297ecd220fd82f83e7f84ea165,1663c78afd70b5fcaf2adf69670e98077f1e772b..c864fdefdb5a68f955264d201dfbb3552c4028b8
@@@ -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) {
        return 0;
  }
  
 -      uint32_t myvnn;
+ /*
+   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;
++      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 &&