[PATCHv2 1/4] mkfs: use strdup in place of strlen,malloc,strcpy sequence
From: Jim Meyering <meyering@xxxxxxxxxx>
* mkfs.c (traverse_directory): No semantic change.
Reviewed-by: Josef Bacik <josef@xxxxxxxxxx>
---
mkfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index c531ef2..03239fb 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -911,8 +911,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
/* Add list for source directory */
dir_entry = malloc(sizeof(struct directory_name_entry));
dir_entry->dir_name = dir_name;
- dir_entry->path = malloc(strlen(dir_name) + 1);
- strcpy(dir_entry->path, dir_name);
+ dir_entry->path = strdup(dir_name);
parent_inum = highest_inum + BTRFS_FIRST_FREE_OBJECTID;
dir_entry->inum = parent_inum;
--
1.7.10.208.gb4267
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux NFS]
[Linux NILFS]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]