Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/config/config.c

PATCH [email protected] 2 participants 2 messages Jul 8, 2007 – Jul 12, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at 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

WHATS_NEW +5 -4
@@ -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.
lib/config/config.c +101 -30

236 lines not on this page · raw message

#1 lore raw

small improvements

I was reading recent patches and saw a couple ways to make small improvements.

I hope you don't mind...

Subject: [PATCH] (_line_append): Add __attribute__ ((format(printf...

---
 lib/config/config.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
lib/config/config.c +2 -0
index b5f0038..f8ed9ee 100644
@@ -361,6 +361,8 @@ static int _line_start(struct output_line *outline)
 }
 
 static int _line_append(struct output_line *outline, const char *fmt, ...)
+  __attribute__ ((format(printf, 2, 3)));
+static int _line_append(struct output_line *outline, const char *fmt, ...)
 {
 	char buf[4096];
 	va_list ap;

Subject: [PATCH] Don't hard-code 4095.

---
 lib/config/config.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
lib/config/config.c +3 -2
index f8ed9ee..d3d7e4d 100644
@@ -367,10 +367,11 @@ static int _line_append(struct output_line *outline, const char *fmt, ...)
 	char buf[4096];
 	va_list ap;
 	int n;
+	size_t lim = sizeof buf - 1;
 
 	va_start(ap, fmt);
-	n = vsnprintf(&buf[0], 4095, fmt, ap);
-	if (n < 0 || n > 4095) {
+	n = vsnprintf(buf, lim, fmt, ap);
+	if (n < 0 || n > lim) {
 		log_error("vsnprintf failed for config line");
 		return 0;
 	}