public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/config config.c
@ 2011-01-28 10:19 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-01-28 10:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-01-28 10:19:00

Modified files:
	lib/config     : config.c 

Log message:
	Use memcpy and add error message
	
	strncpy (which check each byte for \0) is not need as we always copy
	the length size - so using memcpy is a bit cheaper.
	
	Add missing log_error message for failed allocation.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88

--- LVM2/lib/config/config.c	2010/12/20 13:53:11	1.87
+++ LVM2/lib/config/config.c	2011/01/28 10:19:00	1.88
@@ -886,9 +886,11 @@
 {
 	size_t len = p->te - p->tb;
 	char *str = dm_pool_alloc(p->mem, len + 1);
-	if (!str)
-		return_0;
-	strncpy(str, p->tb, len);
+	if (!str) {
+		log_error("Failed to duplicate token.");
+		return 0;
+	}
+	memcpy(str, p->tb, len);
 	str[len] = '\0';
 	return str;
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2012-02-23 22:36 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2012-02-23 22:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-23 22:36:22

Modified files:
	lib/config     : config.c 

Log message:
	Drop const modifier from fb
	
	It's not useful here to use const - since we need non-const value for unmap.
	Also remove now unneeded cast.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.112&r2=1.113

--- LVM2/lib/config/config.c	2012/01/23 17:46:31	1.112
+++ LVM2/lib/config/config.c	2012/02/23 22:36:21	1.113
@@ -190,7 +190,7 @@
 			off_t offset, size_t size, off_t offset2, size_t size2,
 			checksum_fn_t checksum_fn, uint32_t checksum)
 {
-	const char *fb, *fe;
+	char *fb, *fe;
 	int r = 0;
 	int use_mmap = 1;
 	off_t mmap_offset = 0;
@@ -240,7 +240,7 @@
 		dm_free(buf);
 	else {
 		/* unmap the file */
-		if (munmap((char *) (fb - mmap_offset), size + mmap_offset)) {
+		if (munmap(fb - mmap_offset, size + mmap_offset)) {
 			log_sys_error("munmap", dev_name(dev));
 			r = 0;
 		}


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2011-12-12  0:08 mornfall
  0 siblings, 0 replies; 9+ messages in thread
From: mornfall @ 2011-12-12  0:08 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2011-12-12 00:08:23

Modified files:
	lib/config     : config.c 

Log message:
	Fix a compiler warning.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.109&r2=1.110

--- LVM2/lib/config/config.c	2011/12/11 23:18:20	1.109
+++ LVM2/lib/config/config.c	2011/12/12 00:08:23	1.110
@@ -364,7 +364,6 @@
 		argv++;
 	}
 
-out:
 	if (fp && dm_fclose(fp)) {
 		stack;
 		r = 0;


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2011-10-11  9:06 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-10-11  9:06 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-11 09:06:10

Modified files:
	lib/config     : config.c 

Log message:
	Add missing log_error for alloc failure

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.106&r2=1.107

--- LVM2/lib/config/config.c	2011/09/02 01:59:07	1.106
+++ LVM2/lib/config/config.c	2011/10/11 09:06:09	1.107
@@ -99,8 +99,10 @@
 		}
 		fb = fb + mmap_offset;
 	} else {
-		if (!(buf = dm_malloc(size + size2)))
-			return_0;
+		if (!(buf = dm_malloc(size + size2))) {
+			log_error("Failed to allocate circular buffer.");
+			return 0;
+		}
 		if (!dev_read_circular(dev, (uint64_t) offset, size,
 				       (uint64_t) offset2, size2, buf)) {
 			goto out;


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2011-07-19 19:12 mornfall
  0 siblings, 0 replies; 9+ messages in thread
From: mornfall @ 2011-07-19 19:12 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2011-07-19 19:12:38

Modified files:
	lib/config     : config.c 

Log message:
	Make it possible to represent type-correct single-item arrays in config trees.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100

--- LVM2/lib/config/config.c	2011/07/19 19:11:24	1.99
+++ LVM2/lib/config/config.c	2011/07/19 19:12:38	1.100
@@ -486,11 +486,11 @@
 			line_append("=");
 			if (v->next) {
 				line_append("[");
-				while (v) {
+				while (v && v->type != CFG_EMPTY_ARRAY) {
 					if (!_write_value(outline, v))
 						return_0;
 					v = v->next;
-					if (v)
+					if (v && v->type != CFG_EMPTY_ARRAY)
 						line_append(", ");
 				}
 				line_append("]");


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2010-11-23 15:09 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2010-11-23 15:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-11-23 15:08:58

Modified files:
	lib/config     : config.c 

Log message:
	Move va_end() so it is also used before error path  return

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.82&r2=1.83

--- LVM2/lib/config/config.c	2010/09/30 21:06:51	1.82
+++ LVM2/lib/config/config.c	2010/11/23 15:08:57	1.83
@@ -381,11 +381,12 @@
 
 	va_start(ap, fmt);
 	n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap);
+	va_end(ap);
+
 	if (n < 0 || n > (int) sizeof buf - 1) {
 		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_grow_object failed for config line");


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2008-08-07 14:02 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2008-08-07 14:02 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2008-08-07 14:02:32

Modified files:
	lib/config     : config.c 

Log message:
	* more strict const

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71

--- LVM2/lib/config/config.c	2008/07/31 13:06:55	1.70
+++ LVM2/lib/config/config.c	2008/08/07 14:02:32	1.71
@@ -1011,7 +1011,7 @@
 	return _find_config_float(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail);
 }
 
-static int _str_in_array(const char *str, const char *values[])
+static int _str_in_array(const char *str, const char * const values[])
 {
 	int i;
 
@@ -1024,9 +1024,8 @@
 
 static int _str_to_bool(const char *str, int fail)
 {
-	static const char *_true_values[] = { "y", "yes", "on", "true", NULL };
-	static const char *_false_values[] =
-	    { "n", "no", "off", "false", NULL };
+	const char * const _true_values[]  = { "y", "yes", "on", "true", NULL };
+	const char * const _false_values[] = { "n", "no", "off", "false", NULL };
 
 	if (_str_in_array(str, _true_values))
 		return 1;


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2006-11-21 15:13 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2006-11-21 15:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-11-21 15:13:36

Modified files:
	lib/config     : config.c 

Log message:
	fix _find_config_node: null parameter is permitted

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50

--- LVM2/lib/config/config.c	2006/11/16 17:36:00	1.49
+++ LVM2/lib/config/config.c	2006/11/21 15:13:36	1.50
@@ -772,7 +772,7 @@
 					     const char *path)
 {
 	const char *e;
-	const struct config_node *cn_found;
+	const struct config_node *cn_found = NULL;
 
 	while (cn) {
 		/* trim any leading slashes */


^ permalink raw reply	[flat|nested] 9+ messages in thread
* LVM2/lib/config config.c
@ 2006-04-28 21:07 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2006-04-28 21:07 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-04-28 21:07:19

Modified files:
	lib/config     : config.c 

Log message:
	missing {

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-23 22:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 10:19 LVM2/lib/config config.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-02-23 22:36 zkabelac
2011-12-12  0:08 mornfall
2011-10-11  9:06 zkabelac
2011-07-19 19:12 mornfall
2010-11-23 15:09 zkabelac
2008-08-07 14:02 zkabelac
2006-11-21 15:13 agk
2006-04-28 21:07 agk

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).