public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/log/log.c
@ 2012-02-08 11:31 zkabelac
  0 siblings, 0 replies; 4+ messages in thread
From: zkabelac @ 2012-02-08 11:31 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-08 11:31:29

Modified files:
	.              : WHATS_NEW 
	lib/log        : log.c 

Log message:
	Move done jump lower
	
	Since before 'goto done' is bufused zeroed, it would otherwise write 1
	byte in front of buffer.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2265&r2=1.2266
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68

--- LVM2/WHATS_NEW	2012/02/08 11:17:34	1.2265
+++ LVM2/WHATS_NEW	2012/02/08 11:31:29	1.2266
@@ -1,5 +1,7 @@
 Version 2.02.91 -
 ===================================
+  Do not write in front of log buffer in print_log().
+  Add boundary test for number of mirror devs and logs.
   Check that whole locking_dir fits _lock_dir buffer in init_file_locking().
   Use list functions for label_exit().
   Ensure strncpy() function always ends with '\0'.
--- LVM2/lib/log/log.c	2012/02/08 11:05:04	1.67
+++ LVM2/lib/log/log.c	2012/02/08 11:31:29	1.68
@@ -388,8 +388,8 @@
 		va_end(ap);
 		bufused += n;
 
-	      done:
 		buf[bufused - 1] = '\n';
+	      done:
 		buf[bufused] = '\n';
 		buf[sizeof(buf) - 1] = '\n';
 		/* FIXME real size bufused */


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

* LVM2 ./WHATS_NEW lib/log/log.c
@ 2011-10-22 16:52 zkabelac
  0 siblings, 0 replies; 4+ messages in thread
From: zkabelac @ 2011-10-22 16:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-22 16:52:01

Modified files:
	.              : WHATS_NEW 
	lib/log        : log.c 

Log message:
	Reduce stack size usage in print_log
	
	As the buf2[] and locn[] can't be used at the same time, safe 1 page from
	stack memory.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2167&r2=1.2168
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66

--- LVM2/WHATS_NEW	2011/10/22 16:42:10	1.2167
+++ LVM2/WHATS_NEW	2011/10/22 16:52:00	1.2168
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Remove extra 4kB buffer allocated on stack in print_log().
   Make move_lv_segment non-static function and use dm_list function.
   Pass exclusive LV locks to all nodes in the cluster.
   Improve lvcreate man documentation of the chunksize option.
--- LVM2/lib/log/log.c	2011/08/11 19:21:42	1.65
+++ LVM2/lib/log/log.c	2011/10/22 16:52:00	1.66
@@ -185,7 +185,7 @@
 	       const char *format, ...)
 {
 	va_list ap;
-	char buf[1024], buf2[4096], locn[4096];
+	char buf[1024], locn[4096];
 	int bufused, n;
 	const char *message;
 	const char *trformat;		/* Translated format string */
@@ -221,7 +221,7 @@
 	    (_store_errmsg && (level <= _LOG_ERR)) ||
 	    log_once) {
 		va_start(ap, format);
-		n = vsnprintf(buf2, sizeof(buf2) - 1, trformat, ap);
+		n = vsnprintf(locn, sizeof(locn) - 1, trformat, ap);
 		va_end(ap);
 
 		if (n < 0) {
@@ -230,8 +230,8 @@
 			goto log_it;
 		}
 
-		buf2[sizeof(buf2) - 1] = '\0';
-		message = &buf2[0];
+		locn[sizeof(locn) - 1] = '\0';
+		message = &locn[0];
 	}
 
 /* FIXME Avoid pointless use of message buffer when it'll never be read! */


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

* LVM2 ./WHATS_NEW lib/log/log.c
@ 2008-06-17 14:14 wysochanski
  0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2008-06-17 14:14 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-06-17 14:14:00

Modified files:
	.              : WHATS_NEW 
	lib/log        : log.c 

Log message:
	Fix identifier 'error_message_produced' used ambiguously.
	
	Related compiler warning:
	log/log.c:242: warning: declaration of 'error_message_produced' shadows a global declaration
	../include/log.h:98: warning: shadowed declaration is here

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.904&r2=1.905
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47

--- LVM2/WHATS_NEW	2008/06/13 14:37:15	1.904
+++ LVM2/WHATS_NEW	2008/06/17 14:14:00	1.905
@@ -1,5 +1,6 @@
 Version 2.02.39 -
 ================================
+  Fix ambiguous use of identifier 'error_message_produced'.
   Begin syncing configure.in for merge/unification with device-mapper.
   Fix add_mirror_images not to dereference uninitialized log_lv upon failure.
   Don't call openlog for every debug line output by clvmd.
--- LVM2/lib/log/log.c	2008/06/06 19:28:33	1.46
+++ LVM2/lib/log/log.c	2008/06/17 14:14:00	1.47
@@ -239,9 +239,9 @@
 	_indent = indent;
 }
 
-void init_error_message_produced(int error_message_produced)
+void init_error_message_produced(int value)
 {
-	_error_message_produced = error_message_produced;
+	_error_message_produced = value;
 }
 
 int error_message_produced(void)


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

* LVM2 ./WHATS_NEW lib/log/log.c
@ 2008-04-07 13:53 mbroz
  0 siblings, 0 replies; 4+ messages in thread
From: mbroz @ 2008-04-07 13:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2008-04-07 13:53:27

Modified files:
	.              : WHATS_NEW 
	lib/log        : log.c 

Log message:
	Fix output if overriding command_names on cmdline.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.826&r2=1.827
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43

--- LVM2/WHATS_NEW	2008/04/07 10:23:46	1.826
+++ LVM2/WHATS_NEW	2008/04/07 13:53:26	1.827
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Fix output if overriding command_names on cmdline.
   Add detection of clustered mirror log capability.
   Add check to vg_commit() ensuring VG lock held before writing new VG metadata.
   Add validation of LV name to pvmove -n.
--- LVM2/lib/log/log.c	2008/01/30 13:59:59	1.42
+++ LVM2/lib/log/log.c	2008/04/07 13:53:26	1.43
@@ -215,12 +215,18 @@
 
 void set_cmd_name(const char *cmd)
 {
-	if (!_log_cmd_name)
-		return;
 	strncpy(_cmd_name, cmd, sizeof(_cmd_name));
 	_cmd_name[sizeof(_cmd_name) - 1] = '\0';
 }
 
+static const char *_command_name()
+{
+	if (!_log_cmd_name)
+		return "";
+
+	return _cmd_name;
+}
+
 void init_msg_prefix(const char *prefix)
 {
 	strncpy(_msg_prefix, prefix, sizeof(_msg_prefix));
@@ -352,7 +358,7 @@
 			    _verbose_level <= _LOG_DEBUG)
 				break;
 			if (_verbose_level >= _LOG_DEBUG) {
-				fprintf(stderr, "%s%s%s", locn, _cmd_name,
+				fprintf(stderr, "%s%s%s", locn, _command_name(),
 					_msg_prefix);
 				if (_indent)
 					fprintf(stderr, "      ");
@@ -363,7 +369,7 @@
 
 		case _LOG_INFO:
 			if (_verbose_level >= _LOG_INFO) {
-				fprintf(stderr, "%s%s%s", locn, _cmd_name,
+				fprintf(stderr, "%s%s%s", locn, _command_name(),
 					_msg_prefix);
 				if (_indent)
 					fprintf(stderr, "    ");
@@ -373,7 +379,7 @@
 			break;
 		case _LOG_NOTICE:
 			if (_verbose_level >= _LOG_NOTICE) {
-				fprintf(stderr, "%s%s%s", locn, _cmd_name,
+				fprintf(stderr, "%s%s%s", locn, _command_name(),
 					_msg_prefix);
 				if (_indent)
 					fprintf(stderr, "  ");
@@ -383,14 +389,15 @@
 			break;
 		case _LOG_WARN:
 			if (_verbose_level >= _LOG_WARN) {
-				fprintf(use_stderr ? stderr : stdout, "%s%s", _cmd_name, _msg_prefix);
+				fprintf(use_stderr ? stderr : stdout, "%s%s",
+					_command_name(), _msg_prefix);
 				vfprintf(use_stderr ? stderr : stdout, trformat, ap);
 				fputc('\n', use_stderr ? stderr : stdout);
 			}
 			break;
 		case _LOG_ERR:
 			if (_verbose_level >= _LOG_ERR) {
-				fprintf(stderr, "%s%s%s", locn, _cmd_name,
+				fprintf(stderr, "%s%s%s", locn, _command_name(),
 					_msg_prefix);
 				vfprintf(stderr, trformat, ap);
 				fputc('\n', stderr);
@@ -399,7 +406,7 @@
 		case _LOG_FATAL:
 		default:
 			if (_verbose_level >= _LOG_FATAL) {
-				fprintf(stderr, "%s%s%s", locn, _cmd_name,
+				fprintf(stderr, "%s%s%s", locn, _command_name(),
 					_msg_prefix);
 				vfprintf(stderr, trformat, ap);
 				fputc('\n', stderr);
@@ -413,7 +420,7 @@
 		return;
 
 	if (_log_to_file && (_log_while_suspended || !memlock())) {
-		fprintf(_log_file, "%s:%d %s%s", file, line, _cmd_name,
+		fprintf(_log_file, "%s:%d %s%s", file, line, _command_name(),
 			_msg_prefix);
 
 		va_start(ap, format);
@@ -436,7 +443,7 @@
 		memset(&buf, ' ', sizeof(buf));
 		bufused = 0;
 		if ((n = dm_snprintf(buf, sizeof(buf) - bufused - 1,
-				      "%s:%d %s%s", file, line, _cmd_name,
+				      "%s:%d %s%s", file, line, _command_name(),
 				      _msg_prefix)) == -1)
 			goto done;
 


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

end of thread, other threads:[~2012-02-08 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 11:31 LVM2 ./WHATS_NEW lib/log/log.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2011-10-22 16:52 zkabelac
2008-06-17 14:14 wysochanski
2008-04-07 13:53 mbroz

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