fs/dir: provide absolute directory path for F_GETPATH by fcntl
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
dad6b105ca
commit
7bbabc74fb
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -571,6 +572,7 @@ int dir_allocate(FAR struct file *filep, FAR const char *relpath)
|
|||
{
|
||||
FAR struct fs_dirent_s *dir;
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
char path_prefix[PATH_MAX];
|
||||
int ret;
|
||||
|
||||
/* Is this a node in the pseudo filesystem? Or a mountpoint? */
|
||||
|
@ -596,7 +598,8 @@ int dir_allocate(FAR struct file *filep, FAR const char *relpath)
|
|||
}
|
||||
}
|
||||
|
||||
dir->fd_path = strdup(relpath);
|
||||
inode_getpath(inode, path_prefix);
|
||||
asprintf(&dir->fd_path, "%s%s/", path_prefix, relpath);
|
||||
filep->f_inode = &g_dir_inode;
|
||||
filep->f_priv = dir;
|
||||
inode_addref(&g_dir_inode);
|
||||
|
|
Loading…
Reference in New Issue