mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
fs/tmpfs: Skip any slash at the beginning of relpath
`tmpfs_stat()` fails when relpath start with slash.
Log
Host
$ adb -s 1234 pull /tmp/subdir
adb: warning: skipping special file '/tmp/subdir/uname' (mode = 0o0)
/tmp/subdir/: 0 files pulled. 1 file skipped.
Device
state_process_list (411): stat failed </tmp/subdir//uname> -1 22
Ref: https://github.com/apache/nuttx/blame/master/libs/libc/stdlib/lib_realpath.c#L111
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
@@ -889,6 +889,14 @@ static int tmpfs_find_object(FAR struct tmpfs_s *fs,
|
|||||||
* relpath.
|
* relpath.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Skip any slash. */
|
||||||
|
|
||||||
|
while (*segment == '/')
|
||||||
|
{
|
||||||
|
segment++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
next_segment = memchr(segment, '/', len);
|
next_segment = memchr(segment, '/', len);
|
||||||
if (next_segment)
|
if (next_segment)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user