From mboxrd@z Thu Jan 1 00:00:00 1970 From: swhiteho@redhat.com Date: Tue, 20 May 2008 10:12:44 +0100 Subject: [Cluster-devel] [PATCH 3/3] [GFS2] Prefer strlcpy() over snprintf() In-Reply-To: <12112747742961-git-send-email-swhiteho@redhat.com> References: <1211274764371-git-send-email-swhiteho@redhat.com> <12112747723560-git-send-email-swhiteho@redhat.com> <12112747742961-git-send-email-swhiteho@redhat.com> Message-ID: <12112747762255-git-send-email-swhiteho@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: Jean Delvare strlcpy is faster than snprintf when you don't use the returned value. Signed-off-by: Jean Delvare Signed-off-by: Steven Whitehouse 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