This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c5619cb3fee fs/inode: propagate inode search errors
c5619cb3fee is described below

commit c5619cb3fee900397d90bf64f5e4f5cffe375efb
Author: Megha Rajput <[email protected]>
AuthorDate: Tue Sep 1 17:06:40 2026 +0000

    fs/inode: propagate inode search errors
    
    inode_reserve() previously continued processing all negative return
    values from inode_search(). Only -ENOENT indicates that the target
    inode is absent and creation may continue.
    
    Propagate other search errors through the existing cleanup path to
    avoid continuing inode creation with invalid insertion metadata.
    Assisted-by: GitHub Copilot
    Signed-off-by: Megha Rajput <[email protected]>
---
 fs/inode/fs_inodereserve.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/inode/fs_inodereserve.c b/fs/inode/fs_inodereserve.c
index 3082a523b97..1b3c970e7e1 100644
--- a/fs/inode/fs_inodereserve.c
+++ b/fs/inode/fs_inodereserve.c
@@ -53,6 +53,7 @@ static ino_t g_ino;
 static int inode_namelen(FAR const char *name)
 {
   FAR const char *tmp = name;
+
   while (*tmp && *tmp != '/')
     {
       tmp++;
@@ -210,13 +211,17 @@ int inode_reserve(FAR const char *path,
   SETUP_SEARCH(&desc, path, false);
 
   ret = inode_search(&desc);
-  if (ret >= 0)
+  if (ret != -ENOENT)
     {
       /* It is an error if the node already exists in the tree (or if it
        * lies within a mountpoint, we don't distinguish here).
        */
 
-      ret = -EEXIST;
+      if (ret >= 0)
+        {
+          ret = -EEXIST;
+        }
+
       goto errout_with_search;
     }
 
@@ -249,6 +254,7 @@ int inode_reserve(FAR const char *path,
        */
 
       FAR const char *nextname = inode_nextname(name);
+
       if (*nextname != '\0')
         {
           /* Insert an operationless node */

Reply via email to