[PATCH] partitions: Prefer strlcpy() over snprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subject: partitions: Prefer strlcpy() over snprintf()

strlcpy is faster than snprintf when you don't use the returned value.

Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx>
Cc: Andries Brouwer <aeb@xxxxxx>
---
This patch was already sent on:
 * 2008-05-09

 fs/partitions/check.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.26-rc1.orig/fs/partitions/check.c	2008-05-09 17:35:37.000000000 +0200
+++ linux-2.6.26-rc1/fs/partitions/check.c	2008-05-09 17:39:13.000000000 +0200
@@ -123,7 +123,7 @@ static int (*check_part[])(struct parsed
 char *disk_name(struct gendisk *hd, int part, char *buf)
 {
 	if (!part)
-		snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name);
+		strlcpy(buf, hd->disk_name, BDEVNAME_SIZE);
 	else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1]))
 		snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, part);
 	else


-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux