Skip to content

Commit

Permalink
[GFS2] Prefer strlcpy() over snprintf()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Steven Whitehouse committed May 12, 2008
1 parent ad99f77 commit 00377d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, '/')))
Expand Down

0 comments on commit 00377d8

Please sign in to comment.