from Michael Adams : allow #-style comments in the nodes and public
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 7 Oct 2008 08:25:10 +0000 (19:25 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 7 Oct 2008 08:25:10 +0000 (19:25 +1100)
addresses file

server/ctdb_server.c
server/ctdb_takeover.c

index 19c8c2c8d5ba831e3f601631dae58c2d8aa3a5af..b41101d205cdeb57e208fc6084a9951b15e62926 100644 (file)
@@ -158,7 +158,20 @@ int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
        }
 
        for (i=0;i<nlines;i++) {
-               if (ctdb_add_node(ctdb, lines[i]) != 0) {
+               char *node;
+
+               node = lines[i];
+               /* strip leading spaces */
+               while((*node == ' ') || (*node == '\t')) {
+                       node++;
+               }
+               if (*node == '#') {
+                       continue;
+               }
+               if (strcmp(node, "") == 0) {
+                       continue;
+               }
+               if (ctdb_add_node(ctdb, node) != 0) {
                        talloc_free(lines);
                        return -1;
                }
index 8bdf30820186f9f1282d5339693c65df0603b462..dcdaadaec13681006e3b7c512dcaffc1c23fa1c5 100644 (file)
@@ -451,9 +451,19 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
                unsigned mask;
                ctdb_sock_addr addr;
                const char *iface;
-               char *tok;
+               char *tok, *line;
 
-               tok = strtok(lines[i], " \t");
+               line = lines[i];
+               while ((*line == ' ') || (*line == '\t')) {
+                       line++;
+               }
+               if (*line == '#') {
+                       continue;
+               }
+               if (strcmp(line, "")) {
+                       continue;
+               }
+               tok = strtok(line, " \t");
                if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
                        DEBUG(DEBUG_CRIT,("Badly formed line %u in public address list\n", i+1));
                        talloc_free(lines);