raiden00pl opened a new pull request, #3853:
URL: https://github.com/apache/nuttx-apps/pull/3853

   ## Summary
   
   - nshlib/nsh_fscmd:improve symlink handling in ls_handler
     This patch modifies the `ls_handler` logic to improve the handling
     of symbolic links (symlinks). First, call lstat() to check if the
     current file is a symlink. If the file is determined to be a symlink,
     then call stat() to obtain the information of the target file.
   
     Cherry-picked from open-vela/nuttx-apps commit 5d977c2
     (open-vela/nuttx-apps@5d977c2).
   
     Signed-off-by: zhengyu16 <[email protected]>
   
   - nshlib/nsh_fscmds.c: Add a blank line after declarations.
   
   - nshlib/nsh_fscmds.c: Fix ln -s target leak without environment.
   ln -s duplicated the target with strdup() but released it with
   nsh_freefullpath(), which is a no-op with CONFIG_DISABLE_ENVIRON.
   Pass the argument to symlink() directly and free only the full path
   built for hard links.
   
   ## Impact
   
   POSIX requires ln -s to store the target verbatim; NSH made it absolute, and 
readlink lacked NUL termination.
   
   ## Testing
   
   detected by automate tests from https://github.com/railab/nuttx-testlab
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to