Skip to content

Commit

Permalink
There's no need to prepend the filename with '/fs/' for file operatio…
Browse files Browse the repository at this point in the history
…ns since that's not done for any of the other file operations (#51)
  • Loading branch information
aentinger authored Jul 9, 2020
1 parent 2fe9f0c commit 701b3c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,11 +1260,11 @@ int renameFile(const uint8_t command[], uint8_t response[]) {
char old_file_name[64 + 1] = {0};
char new_file_name[64 + 1] = {0};

strcpy(old_file_name, "/fs/");
memcpy(&old_file_name[strlen(old_file_name)], &command[4], command[3]);
memset(old_file_name, 0, sizeof(old_file_name));
memcpy(old_file_name, &command[4], command[3]);

strcpy(new_file_name, "/fs/");
memcpy(&new_file_name[strlen(new_file_name)], &command[5 + command[3]], command[4 + command[3]]);
memset(new_file_name, 0, sizeof(new_file_name));
memcpy(new_file_name, &command[5 + command[3]], command[4 + command[3]]);

errno = 0;
rename(old_file_name, new_file_name);
Expand All @@ -1274,7 +1274,7 @@ int renameFile(const uint8_t command[], uint8_t response[]) {
response[3] = 1; /* Length of parameter 1 */
response[4] = errno; /* The actual payload */

return 0;
return 6;
}

int existsFile(const uint8_t command[], uint8_t response[]) {
Expand Down

0 comments on commit 701b3c0

Please sign in to comment.