public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2006-04-28 13:31 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2006-04-28 13:31 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2006-04-28 13:30:59
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Ignore empty strings in config files.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.371&r2=1.372
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2011-07-21 13:23 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2011-07-21 13:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-07-21 13:23:49
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Compare also file size to detect changed config file
Clvmd detects modifed config file before it takes lv_lock.
If the config file is changed rapidly - the change was ignored within
a seocnd ranged. This patch adds also compare of file size.
So change like some flag for 0 to 1 would pass unnoticed - but
it's quick fix for failing test suite.
FIXME: Implement inotify solution.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2042&r2=1.2043
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101
--- LVM2/WHATS_NEW 2011/07/08 19:57:33 1.2042
+++ LVM2/WHATS_NEW 2011/07/21 13:23:48 1.2043
@@ -1,5 +1,6 @@
Version 2.02.87 -
===============================
+ Compare also file size to detect changed config file.
Version 2.02.86 - 8th July 2011
===============================
--- LVM2/lib/config/config.c 2011/07/19 19:12:38 1.100
+++ LVM2/lib/config/config.c 2011/07/21 13:23:49 1.101
@@ -62,6 +62,7 @@
struct config_tree cft;
struct dm_pool *mem;
time_t timestamp;
+ off_t st_size;
char *filename;
int exists;
int keep_open;
@@ -309,6 +310,7 @@
}
c->timestamp = info.st_ctime;
+ c->st_size = info.st_size;
return r;
}
@@ -352,7 +354,7 @@
}
/* Unchanged? */
- if (c->timestamp == info.st_ctime)
+ if (c->timestamp == info.st_ctime && c->st_size == info.st_size)
return 0;
reload:
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2010-12-20 13:53 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2010-12-20 13:53 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-12-20 13:53:11
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Add checks for allocation errors in config node clonning.
Add checks for clonning allocation a fail-out when something is
not allocated correctly.
Also move var declaration to the begining of the function
and fix log_error messages.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1844&r2=1.1845
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87
--- LVM2/WHATS_NEW 2010/12/20 13:45:39 1.1844
+++ LVM2/WHATS_NEW 2010/12/20 13:53:10 1.1845
@@ -1,5 +1,6 @@
Version 2.02.79 -
===================================
+ Add checks for allocation errors in config node clonning.
Fix error path if regex engine cannot be created in _build_matcher().
Use char* arithmetic in target_version(), _process_all(), _targets().
Fixing const cast gcc warnings in the code.
--- LVM2/lib/config/config.c 2010/12/20 13:19:13 1.86
+++ LVM2/lib/config/config.c 2010/12/20 13:53:11 1.87
@@ -1330,30 +1330,53 @@
static struct config_value *_clone_config_value(struct dm_pool *mem, const struct config_value *v)
{
+ struct config_value *new_cv;
+
if (!v)
return NULL;
- struct config_value *new = _create_value(mem);
- new->type = v->type;
- if (v->type == CFG_STRING)
- new->v.str = dm_pool_strdup(mem, v->v.str);
- else
- new->v = v->v;
- new->next = _clone_config_value(mem, v->next);
- return new;
+
+ if (!(new_cv = _create_value(mem))) {
+ log_error("Failed to clone config value.");
+ return NULL;
+ }
+
+ new_cv->type = v->type;
+ if (v->type == CFG_STRING) {
+ if (!(new_cv->v.str = dm_pool_strdup(mem, v->v.str))) {
+ log_error("Failed to clone config string value.");
+ return NULL;
+ }
+ } else
+ new_cv->v = v->v;
+
+ if (v->next && !(new_cv->next = _clone_config_value(mem, v->next)))
+ return_NULL;
+
+ return new_cv;
}
struct config_node *clone_config_node(struct dm_pool *mem, const struct config_node *cn,
int siblings)
{
+ struct config_node *new_cn;
+
if (!cn)
return NULL;
- struct config_node *new = _create_node(mem);
- new->key = dm_pool_strdup(mem, cn->key);
- new->child = clone_config_node(mem, cn->child, 1);
- new->v = _clone_config_value(mem, cn->v);
- if (siblings)
- new->sib = clone_config_node(mem, cn->sib, siblings);
- else
- new->sib = NULL;
- return new;
+
+ if (!(new_cn = _create_node(mem))) {
+ log_error("Failed to clone config node.");
+ return NULL;
+ }
+
+ if ((cn->key && !(new_cn->key = dm_pool_strdup(mem, cn->key)))) {
+ log_error("Failed to clone config node key.");
+ return NULL;
+ }
+
+ if ((cn->v && !(new_cn->v = _clone_config_value(mem, cn->v))) ||
+ (cn->child && !(new_cn->child = clone_config_node(mem, cn->child, 1))) ||
+ (siblings && cn->sib && !(new_cn->sib = clone_config_node(mem, cn->sib, siblings))))
+ return_NULL; /* 'new_cn' released with mem pool */
+
+ return new_cn;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2010-11-30 22:23 zkabelac
0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2010-11-30 22:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-11-30 22:23:35
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Add missing test for failed pool allocation
Add test for NULL from dm_poll_create.
Reorder dm_pool_destroy() before file close and add label out:.
Avoid leaking file descriptor if the allocation fails.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1816&r2=1.1817
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
--- LVM2/WHATS_NEW 2010/11/30 22:16:25 1.1816
+++ LVM2/WHATS_NEW 2010/11/30 22:23:35 1.1817
@@ -1,5 +1,6 @@
Version 2.02.78 -
====================================
+ Add missing test for failed pool allocation in write_config_node().
Replace snprintf with dm_snprintf in clvmd-command.c.
Check reallocated buffer for NULL before use in clvmd do_command().
Fix memory leak when VG allocation policy in metadata is invalid.
--- LVM2/lib/config/config.c 2010/11/23 15:08:57 1.83
+++ LVM2/lib/config/config.c 2010/11/30 22:23:35 1.84
@@ -511,7 +511,8 @@
{
struct output_line outline;
outline.fp = NULL;
- outline.mem = dm_pool_create("config_line", 1024);
+ if (!(outline.mem = dm_pool_create("config_line", 1024)))
+ return_0;
outline.putline = putline;
outline.putline_baton = baton;
if (!_write_config(cn, 0, &outline, 0)) {
@@ -538,7 +539,10 @@
return 0;
}
- outline.mem = dm_pool_create("config_line", 1024);
+ if (!(outline.mem = dm_pool_create("config_line", 1024))) {
+ r = 0;
+ goto_out;
+ }
log_verbose("Dumping configuration to %s", file);
if (!argc) {
@@ -559,12 +563,14 @@
argv++;
}
+ dm_pool_destroy(outline.mem);
+
+out:
if (outline.fp && lvm_fclose(outline.fp, file)) {
stack;
r = 0;
}
- dm_pool_destroy(outline.mem);
return r;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2008-06-03 17:51 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2008-06-03 17:51 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2008-06-03 17:51:04
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Correct config file line numbers in messages when parsing comments. (kabi)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.878&r2=1.879
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.68&r2=1.69
--- LVM2/WHATS_NEW 2008/05/30 15:27:44 1.878
+++ LVM2/WHATS_NEW 2008/06/03 17:51:03 1.879
@@ -1,5 +1,6 @@
Version 2.02.38 -
=================================
+ Correct config file line numbers in messages when parsing comments.
In script-processing mode, stop if any command fails.
Warn if command exits with non-zero status code without a prior log_error.
Make clvmd-cman use a hash rather than an array for node updown info.
--- LVM2/lib/config/config.c 2008/03/12 16:03:21 1.68
+++ LVM2/lib/config/config.c 2008/06/03 17:51:04 1.69
@@ -798,11 +798,9 @@
static void _eat_space(struct parser *p)
{
while ((p->tb != p->fe) && (*p->tb)) {
- if (*p->te == '#') {
+ if (*p->te == '#')
while ((p->te != p->fe) && (*p->te) && (*p->te != '\n'))
p->te++;
- p->line++;
- }
else if (isspace(*p->te)) {
while ((p->te != p->fe) && (*p->te) && isspace(*p->te)) {
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2007-07-20 15:26 meyering
0 siblings, 0 replies; 10+ messages in thread
From: meyering @ 2007-07-20 15:26 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: meyering@sourceware.org 2007-07-20 15:26:39
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
In _line_append, use "sizeof buf - 1" rather than equivalent "4095"
* lib/config/config.c:
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.663&r2=1.664
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61
--- LVM2/WHATS_NEW 2007/07/20 15:22:45 1.663
+++ LVM2/WHATS_NEW 2007/07/20 15:26:39 1.664
@@ -1,4 +1,5 @@
Version 2.02.28 -
+ In _line_append, use "sizeof buf - 1" rather than equivalent "4095"
Introduce is_same_inode macro, now including a comparison of st_dev.
Don't leak a file descriptor in _lock_file(), when flock fails.
Add SUN's LDOM virtual block device to filters
--- LVM2/lib/config/config.c 2007/07/08 22:51:20 1.60
+++ LVM2/lib/config/config.c 2007/07/20 15:26:39 1.61
@@ -367,8 +367,8 @@
int n;
va_start(ap, fmt);
- n = vsnprintf(&buf[0], 4095, fmt, ap);
- if (n < 0 || n > 4095) {
+ n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap);
+ if (n < 0 || n > sizeof buf - 1) {
log_error("vsnprintf failed for config line");
return 0;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2007-07-08 22:51 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2007-07-08 22:51 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-07-08 22:51:21
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Fix dumpconfig to use log_print instead of stdout directly.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.647&r2=1.648
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60
--- LVM2/WHATS_NEW 2007/07/03 13:10:14 1.647
+++ LVM2/WHATS_NEW 2007/07/08 22:51:20 1.648
@@ -1,10 +1,11 @@
Version 2.02.27 -
================================
+ Fix dumpconfig to use log_print instead of stdout directly.
Remove unused parameter 'fid' from _add_pv_to_vg.
- Add kernel and device-mapper targets versions report to lvmdump.
- Don't use index and rindex functions marked by SUSv3 as legacy.
- Fix vgsplit if splitting all PVs from VG.
- Fix lvmdiskscan volume reporting when run in the lvm shell
+ Add kernel and device-mapper targets versions to lvmdump.
+ Replace BSD (r)index with C89 str(r)chr.
+ Handle vgsplit of an entire VG as a vgrename.
+ Reinitialise internal lvmdiskscan variables when called repeatedly.
Fix missing lvm_shell symbol in lvm2cmd library. (2.02.23)
Add vg_status function and clean up vg->status in tools directory.
Add --ignoremonitoring to disable all dmeventd interaction.
--- LVM2/lib/config/config.c 2007/06/13 15:11:19 1.59
+++ LVM2/lib/config/config.c 2007/07/08 22:51:20 1.60
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
@@ -66,6 +66,11 @@
struct device *dev;
};
+struct output_line {
+ FILE *fp;
+ struct dm_pool *mem;
+};
+
static void _get_token(struct parser *p, int tok_prev);
static void _eat_space(struct parser *p);
static struct config_node *_file(struct parser *p);
@@ -345,33 +350,87 @@
return 1;
}
-static void _write_value(FILE *fp, struct config_value *v)
+static int _line_start(struct output_line *outline)
+{
+ if (!dm_pool_begin_object(outline->mem, 128)) {
+ log_error("dm_pool_begin_object failed for config line");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int _line_append(struct output_line *outline, const char *fmt, ...)
+{
+ char buf[4096];
+ va_list ap;
+ int n;
+
+ va_start(ap, fmt);
+ n = vsnprintf(&buf[0], 4095, fmt, ap);
+ if (n < 0 || n > 4095) {
+ log_error("vsnprintf failed for config line");
+ return 0;
+ }
+ va_end(ap);
+
+ if (!dm_pool_grow_object(outline->mem, &buf[0], strlen(buf))) {
+ log_error("dm_pool_grew_object failed for config line");
+ return 0;
+ }
+
+ return 1;
+}
+
+#define line_append(args...) do {if (!_line_append(outline, args)) {return_0;}} while (0)
+
+static int _line_end(struct output_line *outline)
+{
+ const char *line;
+
+ if (!dm_pool_grow_object(outline->mem, "\0", 1)) {
+ log_error("dm_pool_grow_object failed for config line");
+ return 0;
+ }
+
+ line = dm_pool_end_object(outline->mem);
+ if (!outline->fp)
+ log_print("%s", line);
+ else
+ fprintf(outline->fp, "%s\n", line);
+
+ return 1;
+}
+
+static int _write_value(struct output_line *outline, struct config_value *v)
{
switch (v->type) {
case CFG_STRING:
- fprintf(fp, "\"%s\"", v->v.str);
+ line_append("\"%s\"", v->v.str);
break;
case CFG_FLOAT:
- fprintf(fp, "%f", v->v.r);
+ line_append("%f", v->v.r);
break;
case CFG_INT:
- fprintf(fp, "%" PRId64, v->v.i);
+ line_append("%" PRId64, v->v.i);
break;
case CFG_EMPTY_ARRAY:
- fprintf(fp, "[]");
+ line_append("[]");
break;
default:
log_error("_write_value: Unknown value type: %d", v->type);
}
+
+ return 1;
}
-static int _write_config(struct config_node *n, int only_one, FILE *fp,
- int level)
+static int _write_config(struct config_node *n, int only_one,
+ struct output_line *outline, int level)
{
char space[MAX_INDENT + 1];
int l = (level < MAX_INDENT) ? level : MAX_INDENT;
@@ -385,29 +444,38 @@
space[i] = '\0';
do {
- fprintf(fp, "%s%s", space, n->key);
+ if (!_line_start(outline))
+ return_0;
+ line_append("%s%s", space, n->key);
if (!n->v) {
/* it's a sub section */
- fprintf(fp, " {\n");
- _write_config(n->child, 0, fp, level + 1);
- fprintf(fp, "%s}", space);
+ line_append(" {");
+ if (!_line_end(outline))
+ return_0;
+ if (!_line_start(outline))
+ return_0;
+ _write_config(n->child, 0, outline, level + 1);
+ line_append("%s}", space);
} else {
/* it's a value */
struct config_value *v = n->v;
- fprintf(fp, "=");
+ line_append("=");
if (v->next) {
- fprintf(fp, "[");
+ line_append("[");
while (v) {
- _write_value(fp, v);
+ if (!_write_value(outline, v))
+ return_0;
v = v->next;
if (v)
- fprintf(fp, ", ");
+ line_append(", ");
}
- fprintf(fp, "]");
+ line_append("]");
} else
- _write_value(fp, v);
+ if (!_write_value(outline, v))
+ return_0;
}
- fprintf(fp, "\n");
+ if (!_line_end(outline))
+ return_0;
n = n->sib;
} while (n && !only_one);
/* FIXME: add error checking */
@@ -419,25 +487,27 @@
{
struct config_node *cn;
int r = 1;
- FILE *fp;
+ struct output_line outline;
+ outline.fp = NULL;
- if (!file) {
- fp = stdout;
+ if (!file)
file = "stdout";
- } else if (!(fp = fopen(file, "w"))) {
+ else if (!(outline.fp = fopen(file, "w"))) {
log_sys_error("open", file);
return 0;
}
+ outline.mem = dm_pool_create("config_line", 1024);
+
log_verbose("Dumping configuration to %s", file);
if (!argc) {
- if (!_write_config(cft->root, 0, fp, 0)) {
+ if (!_write_config(cft->root, 0, &outline, 0)) {
log_error("Failure while writing to %s", file);
r = 0;
}
} else while (argc--) {
if ((cn = find_config_node(cft->root, *argv))) {
- if (!_write_config(cn, 1, fp, 0)) {
+ if (!_write_config(cn, 1, &outline, 0)) {
log_error("Failure while writing to %s", file);
r = 0;
}
@@ -448,11 +518,12 @@
argv++;
}
- if ((fp != stdout) && fclose(fp)) {
+ if (outline.fp && fclose(outline.fp)) {
log_sys_error("fclose", file);
r = 0;
}
+ dm_pool_destroy(outline.mem);
return r;
}
@@ -918,26 +989,26 @@
}
struct config_node *find_config_tree_node(struct cmd_context *cmd,
- const char *path)
+ const char *path)
{
return _find_first_config_node(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path);
}
const char *find_config_tree_str(struct cmd_context *cmd,
- const char *path, const char *fail)
+ const char *path, const char *fail)
{
return _find_config_str(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail);
}
int find_config_tree_int(struct cmd_context *cmd, const char *path,
- int fail)
+ int fail)
{
/* FIXME Add log_error message on overflow */
return (int) _find_config_int64(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, (int64_t) fail);
}
float find_config_tree_float(struct cmd_context *cmd, const char *path,
- float fail)
+ float fail)
{
return _find_config_float(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2007-03-08 19:22 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2007-03-08 19:22 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-03-08 19:22:52
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Fix two more segfaults if an empty config file section encountered.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.577&r2=1.578
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54
--- LVM2/WHATS_NEW 2007/02/28 18:27:11 1.577
+++ LVM2/WHATS_NEW 2007/03/08 19:22:52 1.578
@@ -1,5 +1,6 @@
Version 2.02.23 -
====================================
+ Fix two more segfaults if an empty config file section encountered.
Move .cache file into a new /etc/lvm/cache directory by default.
Add devices/cache_dir & devices/cache_file_prefix, deprecating devices/cache.
Create directory in fcntl_lock_file() if required.
--- LVM2/lib/config/config.c 2007/01/25 14:37:47 1.53
+++ LVM2/lib/config/config.c 2007/03/08 19:22:52 1.54
@@ -878,7 +878,7 @@
{
const struct config_node *n = _find_first_config_node(cn1, cn2, path);
- if (n && n->v->type == CFG_INT) {
+ if (n && n->v && n->v->type == CFG_INT) {
log_very_verbose("Setting %s to %d", path, n->v->v.i);
return n->v->v.i;
}
@@ -899,7 +899,7 @@
{
const struct config_node *n = _find_first_config_node(cn1, cn2, path);
- if (n && n->v->type == CFG_FLOAT) {
+ if (n && n->v && n->v->type == CFG_FLOAT) {
log_very_verbose("Setting %s to %f", path, n->v->v.r);
return n->v->v.r;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2007-01-17 16:23 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2007-01-17 16:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-01-17 16:22:59
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Fix a segfault if an empty config file section encountered.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.543&r2=1.544
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
--- LVM2/WHATS_NEW 2007/01/16 18:06:10 1.543
+++ LVM2/WHATS_NEW 2007/01/17 16:22:59 1.544
@@ -1,5 +1,6 @@
Version 2.02.19 -
===================================
+ Fix a segfault if an empty config file section encountered.
Move basic reporting functions into libdevmapper.
Fix partition table processing after sparc changes (2.02.16).
Fix cmdline PE range processing segfault (2.02.13).
--- LVM2/lib/config/config.c 2007/01/09 23:22:31 1.51
+++ LVM2/lib/config/config.c 2007/01/17 16:22:59 1.52
@@ -853,7 +853,7 @@
const struct config_node *n = _find_first_config_node(cn1, cn2, path);
/* Empty strings are ignored */
- if ((n && n->v->type == CFG_STRING) && (*n->v->v.str)) {
+ if ((n && n->v && n->v->type == CFG_STRING) && (*n->v->v.str)) {
log_very_verbose("Setting %s to %s", path, n->v->v.str);
return n->v->v.str;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/config/config.c
@ 2006-11-16 17:36 agk
0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2006-11-16 17:36 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2006-11-16 17:36:01
Modified files:
. : WHATS_NEW
lib/config : config.c
Log message:
Warn if certain duplicate config file entries are seen.
(not thoroughly tested)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.498&r2=1.499
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
--- LVM2/WHATS_NEW 2006/11/16 16:44:48 1.498
+++ LVM2/WHATS_NEW 2006/11/16 17:36:00 1.499
@@ -1,5 +1,6 @@
Version 2.02.15 -
====================================
+ Warn if certain duplicate config file entries are seen.
Enhance lvm_dump.sh for sysreport integration and add man page.
Fix --autobackup argument which could never disable backups.
Fix a label_verify error path.
--- LVM2/lib/config/config.c 2006/11/04 03:34:09 1.48
+++ LVM2/lib/config/config.c 2006/11/16 17:36:00 1.49
@@ -772,6 +772,7 @@
const char *path)
{
const char *e;
+ const struct config_node *cn_found;
while (cn) {
/* trim any leading slashes */
@@ -782,22 +783,30 @@
for (e = path; *e && (*e != sep); e++) ;
/* hunt for the node */
+ cn_found = NULL;
while (cn) {
- if (_tok_match(cn->key, path, e))
- break;
+ if (_tok_match(cn->key, path, e)) {
+ /* Inefficient */
+ if (!cn_found)
+ cn_found = cn;
+ else
+ log_error("WARNING: Ignoring duplicate"
+ " config node: %s ("
+ "seeking %s)", cn->key, path);
+ }
cn = cn->sib;
}
- if (cn && *e)
- cn = cn->child;
+ if (cn_found && *e)
+ cn = cn_found->child;
else
break; /* don't move into the last node */
path = e;
}
- return (struct config_node *) cn;
+ return (struct config_node *) cn_found;
}
static struct config_node *_find_first_config_node(const struct config_node *cn1,
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-07-21 13:23 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-28 13:31 LVM2 ./WHATS_NEW lib/config/config.c agk
2006-11-16 17:36 agk
2007-01-17 16:23 agk
2007-03-08 19:22 agk
2007-07-08 22:51 agk
2007-07-20 15:26 meyering
2008-06-03 17:51 agk
2010-11-30 22:23 zkabelac
2010-12-20 13:53 zkabelac
2011-07-21 13:23 zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).