]> sourceware.org Git - lvm2.git/commitdiff
config: recognize a blank comment line
authorDavid Teigland <teigland@redhat.com>
Wed, 12 Aug 2015 20:45:27 +0000 (15:45 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 17 Aug 2015 18:52:34 +0000 (13:52 -0500)
Consider the comment line "#\n" to be a blank line, and
print a blank line at that position when --withspaces is set.

lib/config/config.c

index bfcf87c20e6697b98b24a6406aa726134cea1be8..0c3cf92992255fb3535cd6c6301c1ec2f9370026 100644 (file)
@@ -1695,6 +1695,11 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
                if (cfg_def->comment) {
                        int pos = 0;
                        while (_copy_one_line(cfg_def->comment, commentline, &pos, strlen(cfg_def->comment))) {
+                               if ((commentline[0] == '#') && (strlen(commentline) == 1)) {
+                                       if (!out->tree_spec->withspaces)
+                                               continue;
+                                       commentline[0] = '\0';
+                               }
                                fprintf(out->fp, "%s# %s\n", line, commentline);
                                /* withsummary prints only the first comment line. */
                                if (!out->tree_spec->withcomments)
This page took 0.043516 seconds and 5 git commands to generate.