diff --git a/fs/vfs/fs_statfs.c b/fs/vfs/fs_statfs.c index ff2380fedd6..1b5e8ec15d1 100644 --- a/fs/vfs/fs_statfs.c +++ b/fs/vfs/fs_statfs.c @@ -55,7 +55,7 @@ * Name: statpseudo ****************************************************************************/ -static inline int statpseudofs(FAR struct inode *inode, FAR struct statfs *buf) +static int statpseudofs(FAR struct inode *inode, FAR struct statfs *buf) { memset(buf, 0, sizeof(struct statfs)); buf->f_type = PROC_SUPER_MAGIC; @@ -91,18 +91,25 @@ int statfs(FAR const char *path, FAR struct statfs *buf) /* Sanity checks */ - if (!path || !buf) + if (path == NULL || buf == NULL) { ret = EFAULT; goto errout; } - if (!path[0]) + if (*path == '\0') { ret = ENOENT; goto errout; } + /* Check for the fake root directory (which has no inode) */ + + if (strcmp(path, "/") == 0) + { + return statpseudofs(NULL, buf); + } + /* Get an inode for this file */ SETUP_SEARCH(&desc, path, false);