]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[GFS2] Prefer strlcpy() over snprintf()
authorJean Delvare <khali@linux-fr.org>
Fri, 9 May 2008 15:59:51 +0000 (17:59 +0200)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 12 May 2008 07:57:11 +0000 (08:57 +0100)
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>
fs/gfs2/ops_fstype.c

index ef9c6c4f80f6cb420ba539e26a601240bbb49183..b2028c82e8d1ae53fc04672303ce4e14fa3d7276 100644 (file)
@@ -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, '/')))