From: swhiteho@redhat.com <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/3] [GFS2] Prefer strlcpy() over snprintf()
Date: Tue, 20 May 2008 10:12:44 +0100 [thread overview]
Message-ID: <12112747762255-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <12112747742961-git-send-email-swhiteho@redhat.com>
From: Jean Delvare <khali@linux-fr.org>
strlcpy is faster than snprintf when you don't use the returned value.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ef9c6c4..b2028c8 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -142,8 +142,8 @@ static int init_names(struct gfs2_sbd *sdp, int silent)
if (!table[0])
table = sdp->sd_vfs->s_id;
- snprintf(sdp->sd_proto_name, GFS2_FSNAME_LEN, "%s", proto);
- snprintf(sdp->sd_table_name, GFS2_FSNAME_LEN, "%s", table);
+ strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
+ strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
table = sdp->sd_table_name;
while ((table = strchr(table, '/')))
--
1.5.1.2
next prev parent reply other threads:[~2008-05-20 9:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 9:12 [Cluster-devel] [GFS2] Pre-pull patch posting (bug fixes) swhiteho
2008-05-20 9:12 ` [Cluster-devel] [PATCH 1/3] [GFS2] filesystem consistency error from do_strip swhiteho
2008-05-20 9:12 ` [Cluster-devel] [PATCH 2/3] [GFS2] Fix cast from unsigned int to s64 swhiteho
2008-05-20 9:12 ` swhiteho [this message]
2008-05-20 10:05 ` [Cluster-devel] [GFS2] Pull request Steven Whitehouse
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=12112747762255-git-send-email-swhiteho@redhat.com \
--to=swhiteho@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 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 NNTP newsgroup(s).