From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/config config.c
Date: 28 Jan 2011 10:19:00 -0000 [thread overview]
Message-ID: <20110128101900.1452.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at 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;
}
next reply other threads:[~2011-01-28 10:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-28 10:19 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-02-23 22:36 LVM2/lib/config config.c 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
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=20110128101900.1452.qmail@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.