[PATCH 2/5] imfs: Simplify IMFS_create_node()
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Mar 3 10:50:13 UTC 2020
Update #3894.
---
cpukit/libfs/src/imfs/imfs_creat.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cpukit/libfs/src/imfs/imfs_creat.c b/cpukit/libfs/src/imfs/imfs_creat.c
index b72ae491a6..e476d74852 100644
--- a/cpukit/libfs/src/imfs/imfs_creat.c
+++ b/cpukit/libfs/src/imfs/imfs_creat.c
@@ -33,6 +33,7 @@ IMFS_jnode_t *IMFS_create_node(
)
{
IMFS_jnode_t *allocated_node;
+ char *allocated_name;
IMFS_jnode_t *node;
allocated_node = calloc( 1, node_size + namelen );
@@ -42,10 +43,12 @@ IMFS_jnode_t *IMFS_create_node(
return NULL;
}
+ allocated_name = (char *) allocated_node + node_size;
+ allocated_name = memcpy( allocated_name, name, namelen );
node = IMFS_initialize_node(
allocated_node,
node_control,
- (char *) allocated_node + node_size,
+ allocated_name,
namelen,
mode,
arg
@@ -53,8 +56,6 @@ IMFS_jnode_t *IMFS_create_node(
if ( node != NULL ) {
IMFS_jnode_t *parent = parentloc->node_access;
- memcpy( RTEMS_DECONST( char *, node->name ), name, namelen );
-
/*
* This node MUST have a parent, so put it in that directory list.
*/
--
2.16.4
More information about the devel
mailing list