public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib/metadata mirror.c
Date: Tue, 12 Apr 2011 14:13:00 -0000	[thread overview]
Message-ID: <20110412141318.7422.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-04-12 14:13:18

Modified files:
	lib/metadata   : mirror.c 

Log message:
	Replace dm_snprintf with strncpy
	
	My previous patch fixed incorrect error check for dm_snprintf.
	However in this particular case - dm_snprintf has been used differently -
	just like strncpy + setting last char with '\0' - so the code had to return
	error - because the buffer was to short for whole string.
	
	Patch replaces it with real strncpy.
	Also test for alloca() failure is removed - as the program behaviour
	is rather undefined in this case - it never returns NULL.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.149&r2=1.150

--- LVM2/lib/metadata/mirror.c	2011/04/09 19:05:24	1.149
+++ LVM2/lib/metadata/mirror.c	2011/04/12 14:13:17	1.150
@@ -1785,13 +1785,10 @@
 		lv_name = lv->name;
 		suffix = "_mlogtmp_%d";
 	} else if ((lv_name = strstr(lv->name, MIRROR_SYNC_LAYER))) {
-		len = lv_name - lv->name + 1;
-		if (!(tmp_name = alloca(len)) ||
-		    (dm_snprintf(tmp_name, len, "%s", lv->name) < 0)) {
-			log_error("mirror log name allocation failed");
-			return 0;
-		}
-		lv_name = tmp_name;
+		len = lv_name - lv->name;
+		tmp_name = alloca(len + 1);
+		tmp_name[len] = '\0';
+		lv_name = strncpy(tmp_name, lv->name, len);
 		suffix = "_mlog";
 	} else {
 		lv_name = lv->name;


             reply	other threads:[~2011-04-12 14:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 14:13 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-01 15:05 agk
2011-09-19 14:28 jbrassow
2011-09-16 16:41 jbrassow
2011-09-14  9:54 zkabelac
2011-09-14  4:10 jbrassow
2011-09-13 18:11 jbrassow
2011-06-24 23:39 agk
2011-03-24 12:28 mornfall
2011-01-11 17:21 jbrassow
2010-07-09 17:57 jbrassow
2010-06-23 13:57 jbrassow
2010-04-20 12:14 agk
2010-04-01 14:54 agk
2010-01-08 10:50 zkabelac
2009-12-17 15:59 mornfall
2009-12-09 19:43 mbroz
2009-11-19 13:42 mornfall
2009-11-19 12:09 mornfall
2009-11-18 18:23 mornfall
2009-10-14 14:55 jbrassow
2009-04-23 16:43 mornfall
2008-09-19  4:30 agk
2008-09-19  0:20 agk
2008-01-17 13:37 agk
2008-01-16 19:50 agk
2008-01-16 19:38 agk
2008-01-16 19:11 agk
2008-01-16 19:09 agk
2006-11-10 20:15 agk
2004-05-05 18:35 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110412141318.7422.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).