mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 01:39:44 +08:00
FS: Remove inode_find_nofollow. Instead provide a bool nofollow argument to inode_find.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/driver/fs_openblockdriver.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in pathname and binary forms, with or without
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -93,7 +94,7 @@ int find_blockdriver(FAR const char *pathname, int mountflags, FAR struct inode
|
||||
|
||||
/* Find the inode registered with this pathname */
|
||||
|
||||
inode = inode_find(pathname, NULL);
|
||||
inode = inode_find(pathname, NULL, false);
|
||||
if (!inode)
|
||||
{
|
||||
ferr("ERROR: Failed to find %s\n", pathname);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/fat/fs_fat32attrib.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
@@ -70,7 +71,7 @@ static int fat_attrib(const char *path, fat_attrib_t *retattrib,
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find(path, &relpath);
|
||||
inode = inode_find(path, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no mountpoint that includes in this path */
|
||||
|
||||
+4
-49
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/inode/fs_inodefind.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -64,7 +64,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
|
||||
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath,
|
||||
bool nofollow)
|
||||
{
|
||||
struct inode_search_s desc;
|
||||
FAR struct inode *node = NULL;
|
||||
@@ -83,7 +84,7 @@ FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
|
||||
desc.path = path;
|
||||
|
||||
inode_semtake();
|
||||
ret = inode_search(&desc);
|
||||
ret = nofollow ? inode_search_nofollow(&desc) : inode_search(&desc);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Found it */
|
||||
@@ -106,49 +107,3 @@ FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
|
||||
inode_semgive();
|
||||
return node;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
FAR struct inode *inode_find_nofollow(FAR const char *path,
|
||||
FAR const char **relpath)
|
||||
{
|
||||
struct inode_search_s desc;
|
||||
FAR struct inode *node = NULL;
|
||||
int ret;
|
||||
|
||||
if (path == NULL || *path != '/')
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the node matching the path. If found, increment the count of
|
||||
* references on the node.
|
||||
*/
|
||||
|
||||
memset(&desc, 0, sizeof(struct inode_search_s));
|
||||
desc.path = path;
|
||||
|
||||
inode_semtake();
|
||||
ret = inode_search_nofollow(&desc);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Found it */
|
||||
|
||||
node = desc.node;
|
||||
DEBUGASSERT(node != NULL);
|
||||
|
||||
/* Increment the reference count on the inode */
|
||||
|
||||
node->i_crefs++;
|
||||
|
||||
/* Return any remaining relative path fragment */
|
||||
|
||||
if (relpath != NULL)
|
||||
{
|
||||
*relpath = desc.relpath;
|
||||
}
|
||||
}
|
||||
|
||||
inode_semgive();
|
||||
return node;
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-9
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/inode/inode.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2012, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
@@ -253,14 +254,8 @@ int inode_remove(FAR const char *path);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath);
|
||||
|
||||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
FAR struct inode *inode_find_nofollow(FAR const char *path,
|
||||
FAR const char **relpath);
|
||||
#else
|
||||
# define inode_find_nofollow(p,r) inode_find(p,r)
|
||||
#endif
|
||||
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath,
|
||||
bool nofollow);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_addref
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/mount/fs_mount.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -280,7 +281,7 @@ int mount(FAR const char *source, FAR const char *target,
|
||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||
/* Check if the inode already exists */
|
||||
|
||||
mountpt_inode = inode_find(target, NULL);
|
||||
mountpt_inode = inode_find(target, NULL, false);
|
||||
if (mountpt_inode != NULL)
|
||||
{
|
||||
/* Successfully found. The reference count on the inode has been
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/mount/fs_umount2.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -86,7 +87,7 @@ int umount2(FAR const char *target, unsigned int flags)
|
||||
|
||||
/* Find the mountpt */
|
||||
|
||||
mountpt_inode = inode_find(target, NULL);
|
||||
mountpt_inode = inode_find(target, NULL, false);
|
||||
if (!mountpt_inode)
|
||||
{
|
||||
errcode = ENOENT;
|
||||
|
||||
+4
-3
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/mqueue/mq_open.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sched.h>
|
||||
@@ -128,11 +129,11 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
|
||||
sched_lock();
|
||||
|
||||
/* Get the inode for this mqueue. This should succeed if the message
|
||||
* queue has already been created. In this case, inode_finde() will
|
||||
* queue has already been created. In this case, inode_find() will
|
||||
* have incremented the reference count on the inode.
|
||||
*/
|
||||
|
||||
inode = inode_find(fullpath, &relpath);
|
||||
inode = inode_find(fullpath, &relpath, false);
|
||||
if (inode)
|
||||
{
|
||||
/* It exists. Verify that the inode is a message queue */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/mqueue/mq_unlink.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <mqueue.h>
|
||||
#include <assert.h>
|
||||
@@ -87,7 +88,7 @@ int mq_unlink(FAR const char *mq_name)
|
||||
/* Get the inode for this message queue. */
|
||||
|
||||
sched_lock();
|
||||
inode = inode_find(fullpath, &relpath);
|
||||
inode = inode_find(fullpath, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/semaphore/sem_open.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
@@ -129,11 +130,11 @@ FAR sem_t *sem_open (FAR const char *name, int oflags, ...)
|
||||
snprintf(fullpath, MAX_SEMPATH, CONFIG_FS_NAMED_SEMPATH "/%s", name);
|
||||
|
||||
/* Get the inode for this semaphore. This should succeed if the
|
||||
* semaphore has already been created. In this case, inode_finde()
|
||||
* semaphore has already been created. In this case, inode_find()
|
||||
* will have incremented the reference count on the inode.
|
||||
*/
|
||||
|
||||
inode = inode_find(fullpath, &relpath);
|
||||
inode = inode_find(fullpath, &relpath, false);
|
||||
if (inode)
|
||||
{
|
||||
/* It exists. Verify that the inode is a semaphore */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/semaphore/sem_unlink.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <semaphore.h>
|
||||
#include <sched.h>
|
||||
@@ -91,7 +92,7 @@ int sem_unlink(FAR const char *name)
|
||||
/* Get the inode for this semaphore. */
|
||||
|
||||
sched_lock();
|
||||
inode = inode_find(fullpath, &relpath);
|
||||
inode = inode_find(fullpath, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/unionfs/fs_unionfs.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -2445,7 +2445,7 @@ static int unionfs_getmount(FAR const char *path, FAR struct inode **inode)
|
||||
|
||||
/* Find the mountpt */
|
||||
|
||||
minode = inode_find(path, NULL);
|
||||
minode = inode_find(path, NULL, false);
|
||||
if (!minode)
|
||||
{
|
||||
/* Mountpoint inode not found */
|
||||
|
||||
+2
-1
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@@ -105,7 +106,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
||||
* does not lie on a mounted volume.
|
||||
*/
|
||||
|
||||
inode = inode_find(path2, NULL);
|
||||
inode = inode_find(path2, NULL, false);
|
||||
if (inode != NULL)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
|
||||
+5
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_mkdir.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,9 +38,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -87,7 +90,7 @@ int mkdir(const char *pathname, mode_t mode)
|
||||
|
||||
/* Find the inode that includes this path */
|
||||
|
||||
inode = inode_find(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, false);
|
||||
if (inode)
|
||||
{
|
||||
/* An inode was found that includes this path and possibly refers to a
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_open.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
@@ -120,7 +121,7 @@ int open(const char *path, int oflags, ...)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find(path, &relpath);
|
||||
inode = inode_find(path, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* "O_CREAT is not set and the named file does not exist. Or, a
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@@ -91,7 +92,7 @@ ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize)
|
||||
* symbolic link node.
|
||||
*/
|
||||
|
||||
node = inode_find_nofollow(path, &relpath);
|
||||
node = inode_find(path, &relpath, true);
|
||||
if (node == NULL)
|
||||
{
|
||||
errcode = ENOENT;
|
||||
|
||||
+6
-4
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_rename.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -101,7 +103,7 @@ int rename(FAR const char *oldpath, FAR const char *newpath)
|
||||
|
||||
/* Get an inode that includes the oldpath */
|
||||
|
||||
oldinode = inode_find(oldpath, &oldrelpath);
|
||||
oldinode = inode_find(oldpath, &oldrelpath, true);
|
||||
if (!oldinode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
@@ -115,11 +117,11 @@ int rename(FAR const char *oldpath, FAR const char *newpath)
|
||||
|
||||
if (INODE_IS_MOUNTPT(oldinode) && oldinode->u.i_mops)
|
||||
{
|
||||
/* Get an inode for the new relpath -- it should like on the same
|
||||
/* Get an inode for the new relpath -- it should lie on the same
|
||||
* mountpoint
|
||||
*/
|
||||
|
||||
newinode = inode_find(newpath, &newrelpath);
|
||||
newinode = inode_find(newpath, &newrelpath, true);
|
||||
if (!newinode)
|
||||
{
|
||||
/* There is no mountpoint that includes in this path */
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_rmdir.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -89,7 +91,7 @@ int rmdir(FAR const char *pathname)
|
||||
* on the inode if one is found.
|
||||
*/
|
||||
|
||||
inode = inode_find(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
+2
-1
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
@@ -233,7 +234,7 @@ int stat(FAR const char *path, FAR struct stat *buf)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find_nofollow(path, &relpath);
|
||||
inode = inode_find(path, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* This name does not refer to a psudeo-inode and there is no
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_statfs.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -105,7 +105,7 @@ int statfs(FAR const char *path, FAR struct statfs *buf)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find(path, &relpath);
|
||||
inode = inode_find(path, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* This name does not refer to a psudeo-inode and there is no
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_unlink.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -89,7 +91,7 @@ int unlink(FAR const char *pathname)
|
||||
* which may be a symbolic link)
|
||||
*/
|
||||
|
||||
inode = inode_find_nofollow(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
Reference in New Issue
Block a user