Skip to content

Commit

Permalink
Fix the filename handling in ff_Move
Browse files Browse the repository at this point in the history
The first character of the destination filename was omitted
when a file in the root directory was supplied.

This change was made by hitibosch.
  • Loading branch information
togrue committed Feb 14, 2024
1 parent d44ee93 commit 4268c23
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ff_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,13 +928,6 @@ static FF_FILE * prvAllocFileHandle( FF_IOManager_t * pxIOManager,
uxIndex--;
}

if( uxIndex == 0U )
{
/* Give the directory part a minimum
* length of 1, to get '/' at least. */
uxIndex = 1U;
}

/* Copy the base name of the destination file. */
STRNCPY( xMyFile.pcFileName, ( szDestinationFile + uxIndex + 1 ), ffconfigMAX_FILENAME - 1 );
xMyFile.pcFileName[ ffconfigMAX_FILENAME - 1 ] = 0;
Expand All @@ -944,6 +937,13 @@ static FF_FILE * prvAllocFileHandle( FF_IOManager_t * pxIOManager,
{
xError = FF_createERR( FF_ERR_FILE_INVALID_PATH, FF_MOVE );
}

if( uxIndex == 0U )
{
/* Give the directory part a minimum
* length of 1, to get '/' at least. */
uxIndex = 1U;
}
}

if( FF_isERR( xError ) == pdFALSE )
Expand Down

0 comments on commit 4268c23

Please sign in to comment.