archive_dev: Ensure path separator for local path (#524)
Fixes issue where fopen("test.txt","r") opens 3dstest.txt instead of test.txt. Also correct misuse of strncat() as count applies to src not dest. See:8136d94657
806a4d34c5
This commit is contained in:
parent
8d90551306
commit
39a53c4fe5
@ -205,9 +205,11 @@ archive_fixpath(struct _reent *r,
|
||||
strncpy(__ctru_dev_path_buf, path, PATH_MAX);
|
||||
else
|
||||
{
|
||||
size_t cwdlen = strlen(dev->cwd);
|
||||
strncpy(__ctru_dev_path_buf, dev->cwd, PATH_MAX);
|
||||
__ctru_dev_path_buf[PATH_MAX] = '\0';
|
||||
strncat(__ctru_dev_path_buf, path, PATH_MAX);
|
||||
strncat(__ctru_dev_path_buf, "/", PATH_MAX - cwdlen);
|
||||
strncat(__ctru_dev_path_buf, path, PATH_MAX - cwdlen - 1);
|
||||
}
|
||||
|
||||
if(__ctru_dev_path_buf[PATH_MAX] != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user